Regular Expression Special Characters

. Any single character except a newline
^ The beginning of the line or string
$ The end of the line or string (Use "\r$" instead of "$" for end of line in DOS/Windows.)
* Zero or more of the last character
+ One or more of the last character
? Zero or one of the last character
{5,10} Five to ten times the previous character
for example: * equals {0, }; + equals {1, }
? equals {0,1}

More special characters

[qjk] Either q or j or k
[^qjk] Neither q nor j nor k
[a-z] Anything from a to z inclusive
[^a-z] No lower case letters
[a-zA-Z] Any letter
[a-z]+ Any non-zero sequence of lower case letters
jelly|cream Either jelly or cream
(eg|le)gs Either eggs or legs
(da)+ Either da or dada or dadada or...
\n A newline
\t A tab
\w Any alphanumeric (word) character.
The same as [a-zA-Z0-9_]
\W Any non-word character.
The same as [^a-zA-Z0-9_]
\d Any digit. The same as [0-9]
\D Any non-digit. The same as [^0-9]
\s Any whitespace character: space,
tab, newline, etc
\S Any non-whitespace character
\b A word boundary, outside [] only
\B No word boundary

Escapes for special characters

\| Vertical bar
\[ An open square bracket
\) A closing parenthesis
\* An asterisk
\^ A carat symbol
\/ A slash
\\ A backslash