Regex Tester

Write a regular expression and see matches highlighted as you type (JavaScript syntax).

//g
#MatchGroupsIndex

Regex cheat sheet

.Any character except newline\d \w \sDigit, word character, whitespace
^ $Start / end of line or string\bWord 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|ba 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@]+$

Related tools