Regular Expression Pattern Matching
Dot
Dot
Character
Description Example
. (dot)
Matches any single character except line
break characters \r and \n.
. matches x or most any
other character
Word Boundaries
Word
Boundary
Description Example
\b
Matches at the position between a word character (anything
matched by \w) and a non-word character (anything matched
by [^\w] or \W) as well as at the start and/or end of the string
if the first and/or last characters in the string are word
characters.
.\b
matches
c in abc
\B
Matches at the position between two word characters (i.e the
position between \w\w) as well as at the position between
two non-word characters (i.e. \W\W).
\B.\B
matches
b in abc
Alternation
Alternation
Character
Description Example
|
(vertical
bar or
"pipe")
Causes the regular expression engine to match either
the part on the left side or the part on the right side.
Can be strung together into a series of options.
abc|def|xyz
matches
abc, def or
xyz
|
(vertical
bar or
"pipe")
The vertical bar has the lowest precedence of all
operators. Use grouping to alternate only part of the
regular expression.
abc(def|xyz)
matches
abcdef or
abcxyz
366