Package java.util.regex

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


                                               request, String
           path, int start)
   {
      UriInfoImpl uriInfo = (UriInfoImpl) request.getUri();
      Matcher matcher = pattern.matcher(path);
      matcher.region(start, path.length());

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


fitting:
    // Fitting the text within the available width...
    {
      Pattern pattern = Pattern.compile("(\\s*)(\\S*)");
      Matcher matcher = pattern.matcher(text);
      matcher.region(beginIndex,text.length());
      while(matcher.find())
      {
        // Scanning for the presence of a line break...
        /*
          NOTE: This text fitting algorithm returns everytime it finds a line break character,
View Full Code Here

        }

        if (searchOptions.isOnlyMatchWholeAttributeValue()) {
            found = matcher.matches();//Try to match the whole value
        } else {
            matcher.region(searchOptions.getRegionStart(), str.length());//Try to match a group in the remaining part of the value
            found = matcher.find();
        }

        if (found) {
            searchOptions.setStartingRow(rowIndex);//For next search
View Full Code Here

        }
      }
      if (elementPattern != null) {
        Matcher matcher = elementPattern.matcher(lineText);
        if (offset > 0) {
          matcher.region(offset, lineText.length());
        }
        if (matcher.find()) {
          for (int x = 0;x<elementGroup.size();++x) {
            int group = elementGroup.get(x);
            String value = matcher.group(group);
View Full Code Here

  @Override
  public BlockTagProcessor start(String lineText, int offset) {
    Matcher matcher = startTagPattern.matcher(lineText);
    if (offset > 0) {
      matcher.region(offset, lineText.length());
    }
    if (matcher.matches()) {
      String options = matcher.group(1);
      int startOffset = matcher.start(2);
      ConfluenceBlockTagProcessor processor = createProcessor();
View Full Code Here

  }

  protected boolean closeBlock(String text,int offset) {
    Matcher matcher = endTagPattern.matcher(text);
    if (offset > 0) {
      matcher.region(offset, text.length());
    }
    if (matcher.matches()) {
      int afterEndOffset = matcher.end(1);
      setLineOffset(afterEndOffset);
      setBlockClosed(true);
View Full Code Here

      if (dialect != null && (modifierProcessor == null || modifierProcessor.getLineStartOffset() < lastOffset)) {
        modifierProcessor = dialect.findPhraseModifier(textileLine, lastOffset);
      }
     
      if (lastOffset > 0 && dialect != null) {
        phraseModifierMatcher.region(lastOffset, textileLineLength);
      }
      int offset = -1;
     
      if (phraseModifierMatcher.find()) {
        offset = phraseModifierMatcher.start();
View Full Code Here

                Matcher m = p.matcher(result);

                boolean match = false;
                // Loop until we've covered the entire offset range
                for (int i = 0; i <= offsetRangeEnd - offsetRangeBegin; i++) {
                    m.region(i,  length+i);
                    match = m.lookingAt(); // match regex from start of region
                    if (match) {
                        return type;
                    }
                }
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

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.