Regular Expressions Cheat Sheet
Regular Expressions Cheat Sheet
Regular Expressions Cheat Sheet
A regular expression is a specific pattern used in computing that provides concise and flexible means to "match"
(specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common
abbreviations for "regular expression" include regex and regexp.
Wikipedia
Character
Description
Example
. (dot)
* (star)
+ (plus)
? (question
mark)
^ (caret)
$ (dollar)
(...) (round
bracket)
Grouping of characters or
(ak) matches "make", "take", '
expression
{n} (curly
Match the previous item
bracket, where
exactly n times
n >= 1)
{n,} (n >=1)
[^...]
| (pipe)
- (hypen)
Specify a range of
[a-z] matches all lowercase alphabet.
characters to match. Used
[A-Z] matches all uppercase alphabet.
mostly with square
[0-9] matches all the digit 0 to 9.
bracket.
\ (backslash)
Escape a special
Character
Description
Example
character
\n, \r,
\t,\d,
\w,\s
\D, \W, \S
\b...\b
\B...\B
[\b]