Invalid regex strings will throw a PatternSyntaxException
at runtime.
This code attempts to compile a regular expression string that is invalid according to Java's syntax
for regular expressions. Because of this, a PatternSyntaxException
will be thrown when
this statement is executed.
Pattern.compile("(\\)");
Perhaps the intention was to match on a single \\
character:
Pattern.compile("(\\\\)");
java.util.regex.Pattern
JavaDocs