Package java.util.regex

Examples of java.util.regex.Matcher.find()


        if (file.isFile() && file.canRead()) {
          log("  checking " + file + " for GRE_PATH");
          String fileText = FileUtil.readFileAsString(file, 16384);
          if (fileText != null) {
            Matcher matcher = pat.matcher(fileText);
            if (matcher.find()) {
              String possibleGrePath = matcher.group(1);
              if (isValidGrePath(new File(possibleGrePath))) {
                grePath = possibleGrePath;
                break;
              }
View Full Code Here


   */
  public static boolean mkdirs(File f) {
    if (Constants.isOSX) {
      Pattern pat = Pattern.compile("^(/Volumes/[^/]+)");
      Matcher matcher = pat.matcher(f.getParent());
      if (matcher.find()) {
        String sVolume = matcher.group();
        File fVolume = new File(sVolume);
        if (!fVolume.isDirectory()) {
          Logger.log(new LogEvent(LOGID, LogEvent.LT_WARNING, sVolume
              + " is not mounted or not available."));
View Full Code Here

      };
      // magnet:?xt=urn:btih:WENBTYBB7676MQWJ7NLTD4NGYDKYSQPO&dn=[DmzJ][School_Days][Vol.01-06][DVDRip]
      for (String toMatch : titles) {
        Matcher matcher = Pattern.compile("[?&]" + toMatch + "=(.*)&?",
            Pattern.CASE_INSENSITIVE).matcher(url);
        if (matcher.find()) {
          return matcher.group(1);
        }
      }
     
      /*
 
View Full Code Here

    //       would normally prompt again.  This fix reads the version
    //       from the file if we don't have a version yet, thus preventing
    //       the second restart message
    if (version == 0) {
      Matcher matcher = pat.matcher(oldStartupScript);
      if (matcher.find()) {
        String sScriptVersion = matcher.group(1);
        try {
          version = Integer.parseInt(sScriptVersion);
        } catch (Throwable t) {
        }
View Full Code Here

    InputStream stream = getClass().getResourceAsStream("startupScript");
    try {
      String startupScript = FileUtil.readInputStreamAsString(stream, 65535,
          "utf8");
      Matcher matcher = pat.matcher(startupScript);
      if (matcher.find()) {
        String sScriptVersion = matcher.group(1);
        int latestVersion = 0;
        try {
          latestVersion = Integer.parseInt(sScriptVersion);
        } catch (Throwable t) {
View Full Code Here

 
  public static String expandValue(String value) {
    // Replace {*} with a lookup of *
    if (value != null && value.indexOf('}') > 0) {
      Matcher matcher = PAT_PARAM_ALPHA.matcher(value);
      while (matcher.find()) {
        String key = matcher.group(1);
        try {
          String text = getResourceBundleString(key);
          if (text != null) {
            value = value.replaceAll("\\Q{" + key + "}\\E", text);
View Full Code Here

          String endIp = null;
          int level = 0;

          if (parseMode <= 0 || parseMode == 1) {
            Matcher matcher = pattern.matcher(line);
            if (matcher.find()) {
              if (parseMode != 1) {
                parseMode = 1;
              }
              description = matcher.group(1);
              startIp = matcher.group(2);
View Full Code Here

    sb.append(comp.getSequence());
    List ret = new ArrayList();

    Matcher m = urlPattern.matcher(sb);
    int txtStart = 0;
    while(m.find())
    {
      int urlStart = m.start();
      int urlEnd = m.end();
      if(txtStart <= urlStart - 1)
        ret.add(new TextComponent(sb.substring(txtStart, urlStart)));
View Full Code Here

 
  private static AbstractCanvasObject createPath(Element elt) {
    Matcher patt = PATH_REGEX.matcher(elt.getAttribute("d"));
    List<String> tokens = new ArrayList<String>();
    int type = -1; // -1 error, 0 start, 1 curve, 2 polyline
    while (patt.find()) {
      String token = patt.group();
      tokens.add(token);
      if (Character.isLetter(token.charAt(0))) {
        switch (token.charAt(0)) {
        case 'M':
View Full Code Here

    sb.append(comp.getSequence());
    List ret = new ArrayList();

    Matcher m = urlPattern.matcher(sb);
    int txtStart = 0;
    while(m.find())
    {
      int urlStart = m.start();
      int urlEnd = m.end();
      if(txtStart <= urlStart - 1)
        ret.add(new TextComponent(sb.substring(txtStart, urlStart)));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.