Package java.util.regex

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


        Matcher matcher = pattern.matcher("abcde");
        matcher.find();
        assertEquals("abcde", matcher.group());

        matcher = pattern.matcher("abcde");
        matcher.region(0, 2);
        matcher.find();
        assertEquals("ab", matcher.group());

    }
View Full Code Here


        // 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

   {
      int start = 0;
      if (path.charAt(0) == '/') start++;

      Matcher matcher = pattern.matcher(path);
      matcher.region(start, path.length());
      return matcher.matches();
   }

   public String resolve(String name, String path)
   {
View Full Code Here

      ruleManager.getExceptionPattern(ruleMatcher.getRule());
   
    if (pattern != null) {
      Matcher matcher = pattern.matcher(textManager.getText());
      matcher.useTransparentBounds(true);
      matcher.region(ruleMatcher.getBreakPosition(),
          textManager.getText().length());
      return !matcher.lookingAt();
    } else {
      return true;
    }
View Full Code Here

      if (dialect != null && (replacementTokenProcessor == null || replacementTokenProcessor.getLineStartOffset() < lastOffset)) {
        replacementTokenProcessor = dialect.findReplacementToken(textileMarkup, lastOffset);
      }
     
      if (lastOffset > 0 && dialect != null) {
        replacementMatcher.region(lastOffset, textileMarkupLength);
      }
      int offset = -1;
     
      if (replacementMatcher.find()) {
        offset = replacementMatcher.start();
View Full Code Here

    matched = matcher.find(begin);
    assert matched;
    int end = matcher.start();
    pattern = Pattern.compile("&nbsp;([^,]*)(,|$)");
    matcher = pattern.matcher(javadoc);
    matcher.region(begin, end);
    int cnt = 0;
    while (matcher.find()) {
      String name = matcher.group(1);
      names[cnt] = name;
      cnt++;
View Full Code Here

    }
    //System.out.println(lastEndIndex);
    //System.out.println(block.charAt(lastEndIndex - 1));
    //System.out.println(block.substring(lastEndIndex));
    matcher.reset();
    matcher.region(lastEndIndex, block.length() - 1);
    matcher.usePattern(Pattern.compile("[ \\n\\r]*\\}[ \\n\\r]*"));
    String inputFormatPattern = null;
    if (matcher.find()){
      //System.out.println(matcher.end());
      //System.out.println(block.substring(matcher.end()));
View Full Code Here

    public void testMatchesRegionChanged() {
        // Regression for HARMONY-610
        String input = " word ";
        Pattern pattern = Pattern.compile("\\w+");
        Matcher matcher = pattern.matcher(input);
        matcher.region(1, 5);
        assertTrue(matcher.matches());
    }

    public void testAllCodePoints() {
        // Regression for HARMONY-3145
View Full Code Here

        Matcher matcher = pattern.matcher("abcde");
        matcher.find();
        assertEquals("abcde", matcher.group());

        matcher = pattern.matcher("abcde");
        matcher.region(0, 2);
        matcher.find();
        assertEquals("ab", matcher.group());

    }
View Full Code Here

        // 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

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.