Code example for PatternSyntaxException

Methods: getMessage

0
    // 
    private static void compile(String pat) {
	try { 
	    pattern = Pattern.compile(pat);
	} catch (PatternSyntaxException x) {
	    System.err.println(x.getMessage());
	    System.exit(1);
	} 
    } 
 
    // Use the linePattern to break the given CharBuffer into lines, applying 
    // the input pattern to each line to see if we have a match 
    // 
    private static void grep(File f, CharBuffer cb) {
	Matcher lm = linePattern.matcher(cb);	// Line matcher
	Matcher pm = null;			// Pattern matcher
	int lines = 0;
	while (lm.find()) {
	    lines++;
	    CharSequence cs = lm.group(); 	// The current line
Connect your IDE to all the code out there  Get Codota for Java