Regex Tester
Live matching, explanation, and cheat sheet
Matches will appear here
▼ Cheat sheet
Character classes
| . | Any character (except newline) |
| \d | Digit [0-9] |
| \D | Not a digit |
| \w | Word char [a-zA-Z0-9_] |
| \W | Not a word char |
| \s | Whitespace |
| \S | Not whitespace |
| [abc] | Any of a, b, or c |
| [^abc] | Not a, b, or c |
| [a-z] | Range a through z |
Quantifiers
| * | 0 or more |
| + | 1 or more |
| ? | 0 or 1 |
| {n} | Exactly n |
| {n,} | n or more |
| {n,m} | Between n and m |
| *? | 0 or more (lazy) |
| +? | 1 or more (lazy) |
Anchors & boundaries
| ^ | Start of string / line |
| $ | End of string / line |
| \b | Word boundary |
| \B | Not a word boundary |
Groups & lookaround
| (abc) | Capturing group |
| (?:abc) | Non-capturing group |
| (?<n>abc) | Named group |
| \1 | Backreference to group 1 |
| a|b | Alternation (a or b) |
| (?=abc) | Positive lookahead |
| (?!abc) | Negative lookahead |
| (?<=abc) | Positive lookbehind |
| (?<!abc) | Negative lookbehind |