Code example for PatternSyntaxException

Methods: getMessage

0
    te.test( false);
   } 
   catch( PatternSyntaxException psex)
   { 
    te.test( true);
    te.test( "Dangling meta character '*' near index 0\n*\n^".equals( psex.getMessage())); // could fail in future Versions
   } 
  } 
 
  { 
   Pattern p= Pattern.compile( "ab*c");
 
   Matcher m= p.matcher( "ac");
   te.test( m.matches());
 
   te.test( p.matcher( "abc").matches());
 
   te.test( ! p.matcher( "abcd").matches());
 
   te.test( Pattern.matches( "ab*c", "abbc"));
  }