Code example for Matcher

Methods: findreset

0
        assertTrue(m.matches());
 
        p = Pattern.compile(".");
        m = p.matcher("abc");
        assertFalse(m.matches());
        assertTrue(m.find());
        assertFalse(m.matches());
 
        /* Make sure matches() agrees after a reset() */ 
        m.reset("z");
        assertTrue(m.matches());
 
        m.reset("xyz");
        assertFalse(m.matches());
 
        /* Tests class Pattern */ 
 
        assertFalse("Erroneously matched partial string.  " +
                "See http://b/issue?id=754601", Pattern.matches("er", "xer"));
        assertFalse("Erroneously matched partial string.  " +
                "See http://b/issue?id=754601", Pattern.matches("xe", "xer"));