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.getHttpHeaders().getMediaType(), request.getHttpHeaders().getAcceptableMediaTypes());
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

    public void testRegionsIntInt() {
        Pattern p = Pattern.compile("x*");
        Matcher m = p.matcher("axxxxxa");
        assertFalse(m.matches());
       
        m.region(1, 6);
        assertEquals(1, m.regionStart());
        assertEquals(6, m.regionEnd());
        assertTrue(m.matches());
       
        try {
View Full Code Here

        assertEquals(1, m.regionStart());
        assertEquals(6, m.regionEnd());
        assertTrue(m.matches());
       
        try {
            m.region(1, 0);
            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
       
        try {
View Full Code Here

            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
       
        try {
            m.region(-1, 2);
            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
       
        try {
View Full Code Here

            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
       
        try {
            m.region(10, 11);
            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
       
        try {
View Full Code Here

            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
       
        try {
            m.region(1, 10);
            fail("expected an IOOBE");
        } catch(IndexOutOfBoundsException e) {
        }
    }
   
View Full Code Here

            answer.add(e.getValue());

            matchedDelimiter = false;
            if (m.group(2) != null || m.group(3) != null) {
                // Skip the last '"'.
                m.region(m.end() + 1, m.regionEnd());
            }
        }

        return answer;
    }
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.