Package java.util.regex

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


            if (log.isDebugEnabled()) {
                log.debug("Testing \"{}\" with rule pattern: \"{}\", MATCHED", StringEscapeUtil.escapeJava(path),
                        StringEscapeUtil.escapeJava(patternString));
            }

            return matcher.toMatchResult();
        }

        if (negative && !matched) {
            if (log.isDebugEnabled()) {
                log.debug("Testing \"{}\" with rule pattern: \"{}\", MATCHED", StringEscapeUtil.escapeJava(path),
View Full Code Here


            if (log.isDebugEnabled()) {
                log.debug("Testing \"{}\" with condition pattern: \"{}\", MATCHED",
                        StringEscapeUtil.escapeJava(subsTestString), StringEscapeUtil.escapeJava(patternString));
            }

            return matcher.toMatchResult();
        }

        if (negative && !matched) {
            if (log.isDebugEnabled()) {
                log.debug("Testing \"{}\" with condition pattern: \"{}\", MATCHED",
View Full Code Here

    private static MatchResult createEmptyMatchResult() {
        Matcher matcher = Pattern.compile("^$").matcher("");

        assertTrue(matcher.find());

        return matcher.toMatchResult();
    }

    /** 创建一个替换。替换所有<code>$num</code>所代表的变量。 */
    public MatchResultSubstitution() {
        this("$", EMPTY_MATCH_RESULT);
View Full Code Here

  @NotNull
  private String appendCorrectedLine(@NotNull StringBuilder builder, @NotNull String line) {
    Matcher matcher = PATTERN_HREF.matcher(line);
    int lastCopiedChar = 0;
    while (matcher.find()) {
      MatchResult matchResult = matcher.toMatchResult();
      builder.append(line.substring(lastCopiedChar, matchResult.start()));
      String linkHref = matchResult.group(1);
      String convertedLink = convertLink(linkHref);
      builder.append("<a href=\"")
        .append(convertedLink)
View Full Code Here

        for (final Route<Pattern> acceptedRoute : acceptedRoutes) {
            final Matcher m = acceptedRoute.routingPattern().matcher(path);
            if (m.matches()) {
                // Push match result information and rest of path to match
                rc.pushMatchResult(m.toMatchResult());

                return Continuation.of(request, acceptedRoute.next());
            }
        }
View Full Code Here

        while (iter.hasNext()) {
            String entry = iter.next().trim();
            MatchResult result = null;
            Matcher _preparse_matcher_ = _preparse_pattern_.matcher(entry);
            if (_preparse_matcher_.matches()) {
                result = _preparse_matcher_.toMatchResult();
                String name = result.group(1);
                String version = result.group(2);
                Integer nv = Integer.valueOf(version);
                Integer existing = existingEntries.get(name);
                if (null != existing) {
View Full Code Here

        while (iter.hasPrevious()) {
            String entry = iter.previous().trim();
            MatchResult result = null;
            Matcher _preparse_matcher_ = _preparse_pattern_.matcher(entry);
            if (_preparse_matcher_.matches()) {
                result = _preparse_matcher_.toMatchResult();
                String name = result.group(1);
                String version = result.group(2);
                Integer nv = Integer.valueOf(version);
                Integer existing = existingEntries.get(name);
                if (null != existing) {
View Full Code Here

                "(\\d+)(\\s+(?:\\d+(?:\\-)?){3})?)$", Pattern.MULTILINE);

        Matcher m = pagePattern.matcher(text);

        MatchResult result = null;
        while(m.find()) result = m.toMatchResult();

        if(result != null) {
            //with non capturing groups when a match is found it will either be in group 1 or 2
            String ret = result.group(1) == null ? result.group(2) : result.group(1);
            if(ret.equals(billNo)) {
View Full Code Here

        }

        int lastOffset = isAbsolute ? 1 : 0;
        int windowsDriveEndsAt = -1;
        if ( isAbsolute && hasWindowsDrive.matches() ) {
            windowsDriveEndsAt = hasWindowsDrive.toMatchResult().end( 1 ) + 1;
            lastOffset = windowsDriveEndsAt;
        }

        final boolean isFinalRoot;
        if ( path.length() == 1 && lastOffset == 1 ) {
View Full Code Here

              log.clear();
              m.region(i, i2);
              if (m.matches()) {
                res = parse_i(pattern, i2, end + 1);
                if (res != null) {
                  res.regexes.add(0, m.toMatchResult());
                  log.printLog();
                  return res;
                }
              }
            }
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.