| Character |
Meaning |
| \ |
Indicates
next character should not be interpreted literally if it
normally is, and should be interpreted literally if it
normally isn't. |
| ^ |
Matches
beginning of input or line. |
| $ |
Matches
end of input or line. |
| * |
Matches
0 or more instances of preceding character. |
| + |
Matches
1 or more instances of preceding character. |
| ? |
Matches
0 or 1 instances of preceding character. |
| . |
Matches
any single character other than the newline character. |
| (x) |
Matches
x and remembers the match. |
| x|y |
Matches
either x or y. |
| {n} |
Matches
exactly n instances of preceding character (where n
is an integer). |
| {n,} |
Matches
at least n instances of preceding character (where n
is an integer). |
| {n,m} |
Matches
it least n and at most m instances of preceding
character (where n and m are integers). |
| [xyz] |
Matches
any one of enclosed characters (specify range using hyphen, such
as [0-9]. |
| [^xyz] |
Matches
any character not enclosed (specify range using hyphen, such as
[^0-9]. |
| [\b] |
Matches
a backspace. |
| \b |
Matches
a word boundary, such as a space. |
| \B |
Matches
a nonword boundary. |
| \cX |
Matches
a control character, X. |
| \d |
Matches
a digit character (same as [0-9]). |
| \D |
Matches
a nondigit character (same as [^0-9]). |
| \f |
Matches
a form feed. |
| \n |
Matches
a line feed. |
| \r |
Matches
a carriage return. |
| \s |
Matches
a single white space character, including space, tab, form feed,
and line feed (same as [\f\n\r\t\v]). |
| \S |
Matches
a single non-white-space character (same as [^\f\n\r\t\v]). |
| \t |
Matches
a tab. |
| \v |
Matches
a vertical tab. |
| \w |
Matches
any alphanumeric character, including the underscore (same as
[A-Za-z0-9_]). |
| \W |
Matches
any nonword character (same as [^A-Za-z0-9_]). |
| \n |
A
reference to the last substring matching the nth parenthetical
(where n is a positive integer). |
\ooctal
\xhex |
Matches
an octal or hexadecimal escape value (for embedding ASCII codes). |