Code example for PatternSyntaxException

Methods: getMessage

0
            assertEquals(3, m.end());
            assertTrue(m.find(4));
            assertEquals(6, m.start());
            assertEquals(9, m.end());
        } catch (PatternSyntaxException e) {
            System.out.println(e.getMessage());
            fail();
        } 
    } 
 
    public void testGroups() throws PatternSyntaxException { 
        Pattern p;
        Matcher m;
 
        p = Pattern.compile("(p[0-9]*)#?(q[0-9]*)");
 
        m = p.matcher("p1#q3p2q42p5p71p63#q888");
        assertTrue(m.find());
        assertEquals(0, m.start());
        assertEquals(5, m.end());
        assertEquals(2, m.groupCount());