Regular Expression Quick Reference

Symbolawkcsplitegrepemacsexprgrepperlsedvimeaning
One-character matches
.*********Match any 1 character
[set]*********Match any character in set
[^set]*********Match any character not in set
Quantifiers
R**********Match 0 or more of R
R+* **  *  Match 1 or more of R
R?* **  *  Match 0 or 1 of R
R{n}      *  Match exactly n occurrences of R
R\{n\}     * * 
R{n,m}      *  Match from n to m occurrences of R
R\{n,m\}     * * 
Anchors
^*********Match beginning of line
$*********Match end of line
\<text\>     *1  * Match standalone word (text must be surrounded by non-word characters, beginning of line, or end of line)
\btext\b      *  
Grouping
R1|R2* **  *  Match R1 or R2
( )* **  *  Group contents and remember what was matched
\( \)    *  **
Miscellaneous
\*********Turn off special meaning ("escape")
1 This works with most versions of grep; if it does not, the -w option causes the entire pattern to be treated as a standalone word.