Package java.util.regex

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


      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 41);
        // convert from HEX to raw bytes
        byte[] infohash = ByteFormatter.decodeString(hash.toUpperCase());
        // convert to BASE32
        return "magnet:?xt=urn:btih:" + Base32.encode(infohash);
      }
View Full Code Here


      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 41);
        // convert from HEX to raw bytes
        byte[] infohash = ByteFormatter.decodeString(hash.toUpperCase());
        // convert to BASE32
        return "magnet:?xt=urn:btih:" + Base32.encode(infohash);
      }
View Full Code Here

            // special treatment for function keys
            if(!funcVisited)
            {
                final Matcher funcMatcher = FUNC_EXP.matcher(value);
                if(funcMatcher.find() && funcMatcher.start() == 0 && funcMatcher.end() == value.length())
                {
                    final int funcVal = Integer.parseInt(funcMatcher.group(2));

                    // SWT.F1 is (1 << 24) + 10
                    swtAccelerator = swtAccelerator | ((1 << 24) + (9 + funcVal));
View Full Code Here

            if(matched)
                continue;

            final Matcher valMatcher = SANCTIONED_EXP.matcher(value);
            if(valMatcher.find() && valMatcher.start() == 0)
            {
                final char c = valMatcher.group().charAt(0);

                // avoid possible duplicates (\t is index 0)
                final int subStrIndex = displayValue.indexOf(c + DELIM);
View Full Code Here

    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)));
      String linkText = sb.substring(urlStart, urlEnd);
      try
View Full Code Here

    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)));
      String linkText = sb.substring(urlStart, urlEnd);
      try
View Full Code Here

    int lastlength = 0; // used in newline trimming to see if one block immediately follows the previous
    while (matcher.find())
    {
      // BEGIN: newline trimming
      String after = matcher.group(3); // contents after tag
      if (lastlength == 0 || fileText.charAt(matcher.start() - 1) == '\n') {
        after = after.replaceFirst("^\\r?\\n", "");
      }
      lastlength = after.length();
      // END: newline trimming
      if (matcher.group(1).toUpperCase().equals("BEGIN"))
View Full Code Here

                // Now we need to parse paramType for it's dimensions
                Matcher dMatcher = dimensionPattern.matcher(paramType);

                if (dMatcher.find()) {
                    paramType = paramType.substring(0, dMatcher.start());
                    paramDim = 1;

                    while (dMatcher.find(dMatcher.end())) {
                        paramDim++;
                    }
View Full Code Here

        }
        StringBuilder builder = new StringBuilder();
        Matcher matcher = Pattern.compile("[^\\w]+").matcher(string);
        int pos = 0;
        while (matcher.find()) {
            builder.append(StringUtils.capitalize(string.subSequence(pos, matcher.start()).toString()));
            pos = matcher.end();
        }
        builder.append(StringUtils.capitalize(string.subSequence(pos, string.length()).toString()));
        return builder.toString();
    }
View Full Code Here

        if (!m.matches()) {
            parser.recordError(range, SCHEME_PATTERN_MATCH_FAILED);
            return;
        }
        for (int g = 1; g <= m.groupCount(); g++)
            if (m.start(g) != -1)
                actions[g].check(m, parser, range);

    }
}
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.