We'll finish this series of tutorials on regular
expressions with a list of all of the different special
character combinations that can be used in regular
expressions. The links back to the tutorials that
discuss those patterns will allow you to use this
reference as an index to the tutorials.
|
^
|
beginning of string or
line
|
|
$
|
end of string or line
|
|
\/
|
a single slash character
|
|
\\
|
a single slosh (backslash)
character
|
|
A|B
|
either A or B
|
|
[AFH]
|
any one of the enclosed
characters
|
|
[^AFH]
|
any character except one of the
enclosed characters
|
|
[A-Z]
|
any letter within the specified
range
|
|
[0-9]
|
any number within the specified
range
|
|
\[
|
a single open bracket character
|
|
\]
|
a single close bracket character
|
|
T{n}
|
exactly "n" occurrences of
the previous character or group
|
|
T{n,}
|
"n" or more occurrences of
the previous character or group
|
|
T{n,m}
|
at least "n" and not more
than "m" occurrences of the previous character
or group
|
|
T?
|
zero or one of the previous
character or group
|
|
T*
|
zero or more of the previous
character or group (match the longest string)
|
|
T+
|
one or more of the previous
character or group match the longest string)
|
|
T*?
|
zero or more of the previous
character or group (match the shortest string)
|
|
T+?
|
one or more of the previous
character or group match the shortest string)
|
|
\d
|
any number
|
|
\D
|
anything except a number
|
|
\w
|
any number, letter, or
underscore
|
|
\W
|
anything except a number, letter, or
underscore
|
|
\s
|
any whitespace (spaces, tabs,
linefeeds, carriage returns, and nulls)
|
|
\S
|
anything except whitespace
|
|
.
|
anything except a linefeed or
carriage return
|
|
\t
|
a tab
|
|
\n
|
a new line character
|
|
\r
|
a carriage return
|
|
\f
|
a form feed
|
|
\v
|
a vertical tab
|
|
\0
|
the null character
|
|
\a
|
an alert
|
|
\e
|
escape key
|
|
\cX
|
control-X
|
|
\x99
|
ASCII character 99 (hexadecimal)
|
|
\o999
|
ASCII character 999 (octal)
|
|
\u9999
|
Unicode character 9999
(hexadecimal)
|
|
\b
|
start or end of word (word
boundary)
|
|
[\b]
|
backspace
|
|
(AFH)
|
these characters form a capturing
group
|
|
(?:AFH)
|
these characters form a
non-capturing group
|
|
(?=AFH)
|
lookahead for equal to this
non-capturing group
|
|
(?!AFH)
|
lookahead for not equal to this
non-capturing group
|