String test = "\"This is a backslash \\\", she said."; System.out.print( test );
"This is a backslash \", she said.
Recall (from Chapter 7) that you need a backslash in a regular expression to remove the meaning of a metacharacter.
When using the
matches(String RE) method,
the argument RE must refer to a Java
So sometimes you need a
String that contains backslashes
that are part of the RE.
To do this, use two backslashes in the
String literal for each
backslash you want in the regular expression.
So, if the RE you want to end up with is:
String literal should be:
Say that you want the regular expression
\[dog\] which literaly matches the seven characers: \[dog\]
Write the code that puts those characters into a