Regular expression syntax reference
Character Description Example
. Match any single character other than line breaks a.c Match "abc", "a@c" etc.
\w Matching letters, numbers, underlined (equivalent to [A-Za-z0-9_]) \w+ Match one or more word characters
\d Match number (equivalent to [0-9]) \d{3} Matching three consecutive numbers
\s Match any blank character (space, tab, line breaks) \s+ Match one or more blank characters
^ Matching the start of a string ^Hello Matches the string starting with "Hello"
$ The end position of the matching string world$ Matches the string ending with "world"
* Match the first sub-expression zero or more times ab*c Match "ac", "abc", "abbc" etc.
+ Match the first sub-expression once or more times ab+c Match "abc", "abbc", but not "ac"
? Match the first sub-expression zero or one time colou?r Match "color" or "colour"
{n} Matching the front sub-expression exactly n/n \d{4} Matches four consecutive numbers
{n,} Match the first sub-expression at least n times \w{3,} Match at least three word characters
{n,m} Match the first sub-expression at least n and at most m \d{2,4} Match 2 to 4 numerals
[abc] Match any character in square brackets [aeiou] Match any vowel letter
[^abc] Match any character not in square brackets [^0-9] Match any non-digit character
(abc) Defines the catch group and extracts the matching content (\d{3})-(\d{4}) Match phone numbers and extract area numbers and numbers
| Logical "or" matching the expressions left or right cat|dog Match "cat" or "dog"
\b Match word boundaries \bword\b Match standalone word "word"
Regex Tester
Match results will be displayed here...