Java: Regex Literal Characters
[SERIOUSLY UNDER CONSTRUCTION]
Most characters can simply be written directly in a
regular expression because they're easy to write in
a Java string and they have not special meaning
to the regular expression engine.
But some characters are not easily entered or have
special meaning.
Characters that can't be typed directly
Java provides several ways to represent characters
in a string.
- Using backslash for specific characters.
- Unicode representation.
\\ |
The backslash character |
\t |
The tab character ('\u0009') |
\n |
The newline (line feed) character ('\u000A') |
\r |
The carriage-return character ('\u000D') |
\f |
The form-feed character ('\u000C') |
\a |
The alert (bell) character ('\u0007') |
\e |
The escape character ('\u001B') |
\cx |
The control character corresponding to x |