match · replace · split

Regex Tester

Test JavaScript regular expressions with live match highlighting, a full group table, and replace and split previews

Live match highlighting
Numbered & named group table
Replace preview with $1 and $<name>
Split preview with captures
0 chars

Enter a pattern and a test string to see matches

Common patterns
Click one to load it with a sample test string
Cheat sheet
The JavaScript regex syntax at a glance
.
Any character except newline (unless s)
\d
Digit[0-9]
\D
Not a digit
\w
Word character[A-Za-z0-9_]
\W
Not a word character
\s
Whitespace (space, tab, newline…)
\S
Not whitespace
[abc]
Any one of a, b or c
[^abc]
Any character except a, b or c
[a-z]
Character in the range a–z