Regex Tester

Write and test regular expressions with live match highlighting, group capture, and replace.

Pattern
/ /
Test String
Replace
Replace output

        
Matches 0
Enter a pattern and test string to see matches.
Stats
0 Matches
0 Groups
0 Unique
0 Chars matched
Active flags
No flags active.
Character classes
.Any character (except newline)
\wWord character [a-zA-Z0-9_]
\dDigit [0-9]
\sWhitespace
\WNon-word character
\DNon-digit
\SNon-whitespace
[abc]Any of a, b or c
[^abc]Not a, b or c
[a-z]Range a–z
Anchors
^Start of string / line
$End of string / line
\bWord boundary
\BNon-word boundary
Quantifiers
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{3}Exactly 3
{2,5}2 to 5
*?0 or more (lazy)
+?1 or more (lazy)
Groups
(abc)Capture group
(?:abc)Non-capture group
(?<n>)Named group
a|ba or b (alternation)
Lookaround
(?=)Lookahead
(?!)Negative lookahead
(?<=)Lookbehind
(?<!)Negative lookbehind
Replace tokens
$1Group 1 value
$&Entire match
$`Before match
$'After match