...
As yet another example, consider the Pattern
class that finds extensive use in performing regular expression related tasks. In Java, a given String
literal used for pattern matching is compiled into an instance of the Pattern
type. If the pattern to be matched contains an undesired escape sequence such as a '\n', to avoid it being interpreted by the Java bytecode compiler as an escape sequence, the Pattern
class requires the literal to be preceded by a backslash ('\\\
n', which now correctly denotes back references instead of a new line).
In general, for a particular escape character of the form '\X', the equivalent Java representation is "\\\
X". As an aside, this particular condition gains remarkable importance in automatic exploit signature detection systems and filters that rely on patter matching.
...