Regex Tester
Write a regular expression and see matches highlighted as you type (JavaScript syntax).
Regex cheat sheet
. | Any character except newline | \d \w \s | Digit, word character, whitespace |
^ $ | Start / end of line or string | \b | Word boundary |
* + ? | 0+, 1+, 0 or 1 times | {2,5} | Between 2 and 5 times |
[abc] [^abc] | Any of / none of | (…) (?:…) | Capturing / non-capturing group |
a|b | a or b | (?=…) (?!…) | Lookahead / negative lookahead |
Useful patterns
- Indian mobile number:
^[6-9]\d{9}$
- PIN code:
^[1-9]\d{5}$
- PAN:
^[A-Z]{5}\d{4}[A-Z]$
- Simple email check:
^[^\s@]+@[^\s@]+\.[^\s@]+$