Regular expression escape sequences
Sequence |
Character represented
|
\f |
Form feed, \cL, \x0C, \014
|
\n |
Line feed, newline, \cJ, \x0A, \012
|
\r |
Carriage return, \cM, \x0D, \015
|
\t |
Horizontal tab, \cI, \x09, \011
|
\v |
Vertical tab, \cK, \x0B, \013
|
\/ |
The character: /
|
\\ |
The character: \
|
\. |
The character: .
|
\* |
The character: *
|
\+ |
The character: +
|
\? |
The character: ?
|
\| |
The character: |
|
\( |
The character: (
|
\) |
The character: )
|
\[ |
The character: [
|
\] |
The character: ]
|
\{ |
The character: {
|
\} |
The character: }
|
\C |
A character itself, if not one of the above. Seldom, if ever, used.
|
\cC |
A control character. For example, \cL is a form feed (^L or CtrlL), same as \f.
|
\x## |
A character represented by its code in hexadecimal. For example, \x0A is a newline, same as \n, and \x41 is "A".
|
\### |
A character represented by its code in octal. For example, \012 is a newline, same as \n, and \101 is "A".
|
Regular expression replacement characters