Package java.util.regex

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


        // Regression for HARMONY-713
        Pattern pattern = Pattern.compile("c");

        String inputStr = "aabb.c";
        Matcher matcher = pattern.matcher(inputStr);
        matcher.region(0, 3);

        assertFalse(matcher.find());
    }
   
  /*
 
View Full Code Here


                // If port is the attribute, then comma will not be used as a
                // delimiter
                if (attrName.equalsIgnoreCase("port") || attrName.equalsIgnoreCase("expires")) {
                    int start = matcher.regionStart();
                    matcher = ATTR_PATTERN0.matcher(headerString);
                    matcher.region(start, headerString.length());
                    matcher.lookingAt();
                } else if (cookie.getVersion() == 1 && attrName.startsWith(COMMA_STR)) {
                    // If the last encountered token is comma, and the parsed
                    // attribute is not port, then this attribute/value pair
                    // ends.
View Full Code Here

  public ResourceMethod matchPattern(HttpRequest request, String path, int start)
  {
    UriInfo uriInfo = (UriInfo) request.getUri();
    Matcher matcher = pattern.matcher(path);
    matcher.region(start, path.length());

    if (matcher.matches())
    {
      // we consumed entire path string
      ResourceMethod invoker = match(request.getHttpMethod(), request);
View Full Code Here

   
    harness.check(m.lookingAt(), "Match foo at start of " + s);
    harness.check(m.group(), "food");

    m.reset();
    m.region(9, s.length());
    harness.check(m.lookingAt(), "Match foo at start of " + s.substring(9));
    harness.check(m.group(), "fool");

    m.reset();
    m.region(9, 10);
View Full Code Here

    m.region(9, s.length());
    harness.check(m.lookingAt(), "Match foo at start of " + s.substring(9));
    harness.check(m.group(), "fool");

    m.reset();
    m.region(9, 10);
    harness.check(m.lookingAt(), false,
      "Match foo at start of " + s.substring(9,10));
   
  }
}
View Full Code Here

        Performance perf = new Performance("Slow regular expression");
        perf.setThreshold(slowRegexp);
        itSuggestion.remove();
        Matcher matcher = suggestion.initMatcher(contents);
        for (ContentsChunk chunk : chunks) {
          matcher.region(chunk.getBegin(), chunk.getEnd());
          int authorizedBegin = chunk.getBegin();
          while (matcher.find()) {
            int begin = matcher.start();
            int end = matcher.end();
            boolean shouldKeep = true;
View Full Code Here

        Performance perf = new Performance("Slow regular expression");
        perf.setThreshold(slowRegexp);
        itSuggestion.remove();
        Matcher matcher = suggestion.initMatcher(contents);
        for (ContentsChunk chunk : chunks) {
          matcher.region(chunk.getBegin(), chunk.getEnd());
          int authorizedBegin = chunk.getBegin();
          while (matcher.find()) {
            int begin = matcher.start();
            int end = matcher.end();
            tmpReplacements.clear();
View Full Code Here

        Matcher matcher = suggestion.initMatcher(contents);

        // Check suggestion on every template
        for (PageElementTemplate template : templates) {
          int begin = template.getBeginIndex();
          if (matcher.region(begin, contentsLength).lookingAt()) {
            int end = matcher.end();
            if ((end >= contentsLength) ||
                (!Character.isLetterOrDigit(contents.charAt(end))) ||
                (!Character.isLetterOrDigit(contents.charAt(end - 1)))) {
              result |= addReplacements(
View Full Code Here

        }

        // Check suggestion on every function
        for (PageElementFunction function : functions) {
          int begin = function.getBeginIndex();
          if (matcher.region(begin, contentsLength).lookingAt()) {
            int end = matcher.end();
            if ((end >= contentsLength) ||
                (!Character.isLetterOrDigit(contents.charAt(end))) ||
                (!Character.isLetterOrDigit(contents.charAt(end - 1)))) {
              result |= addReplacements(
View Full Code Here

        Matcher matcher = suggestion.initMatcher(contents);

        // Check suggestion on every internal links
        for (PageElementInternalLink link : links) {
          int begin = link.getBeginIndex();
          if (matcher.region(begin, contentsLength).lookingAt()) {
            int end = matcher.end();
            if ((end >= contentsLength) ||
                (!Character.isLetterOrDigit(contents.charAt(end))) ||
                (!Character.isLetterOrDigit(contents.charAt(end - 1)))) {
              result |= addReplacements(
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.