Specifications

123
Using Special Characters in Expressions
The following characters have a special meaning in regular expressions and should be escaped (prepended by the
backslash character \ ) when you want them interpreted literally:
Examples
Table A.3 provides some examples to help you understand how regular expressions can be used.
\s Space character: shortcut for [ \n\r\t]
[^\s] Non-space character
Miscellaneous
^ Beginning of line
$ End of line
\b Word boundary
\t Tab character
Table A.2: Special Characters
. $
[ (
] )
\ |
* ^
? @
Table A.3: Regular Expressions
Example Matches...
viagra viagra, VIAGRA or vIaGRa
d+ One or more digits: 0, 42, 007
(bad|good) letters 'bad' or matches the letters 'good'
^free letters 'free' at the beginning of a line
v[i1]agra viagra or v1agra
v(ia|1a)gra viagra or v1agra
v\|agra v|agra
v(i|1|\|)?agra vagra, viagra, v1agra or v|agra
Table A.1: Common Regular Expressions
Expression Matches...
139
\*FREE\* *FREE*
\*FREE\* V.*GRA *FREE* VIAGRA, *FREE* VEHICLEGRA, etc