Regex Tester
Write a JavaScript regular expression and see what it matches as you type.
/ / g
Enter a pattern to start.
Highlighted matches
Matches
Quick reference
- .
- any character except a line break
- \d \w \s
- digit, word character, whitespace
- \D \W \S
- not a digit, word character, whitespace
- [abc] [^abc]
- any of / none of a, b, c
- a* a+ a?
- 0 or more, 1 or more, 0 or 1
- a{2,5}
- between 2 and 5 times
- a+?
- lazy: as few as possible
- ^ $
- start / end of string (or line with m)
- \b
- word boundary
- (abc)
- capture group, used as $1
- (?<name>abc)
- named group, used as $<name>
- (?:abc)
- group without capturing
- a|b
- a or b
- (?=a) (?!a)
- followed by / not followed by a
- (?<=a) (?<!a)
- preceded by / not preceded by a
This tester uses your browser's JavaScript regex engine, the same one used by Node.js. Read the full guide for worked examples.