← Home
Regex Tester
Interactive regular expression tester and visualizer
/
/
g
Copy
Explain
g
global
i
case-insensitive
m
multiline
s
dotall
u
unicode
Presets:
Email
URL
Phone
IP Address
Date
Hex Color
HTML Tag
Test String
Replace With
Matches
0 matches
No matches
Explanation
History
clear
Regex Reference
▶
Character Classes
.
Any char (except newline)
\d
Digit [0-9]
\D
Non-digit
\w
Word char [a-zA-Z0-9_]
\W
Non-word char
\s
Whitespace
\S
Non-whitespace
[abc]
Any of a, b, or c
[^abc]
Not a, b, or c
[a-z]
Range a through z
Quantifiers
*
0 or more (greedy)
+
1 or more (greedy)
?
0 or 1 (optional)
{n}
Exactly n times
{n,}
n or more times
{n,m}
Between n and m times
*? +?
Lazy versions
Anchors & Boundaries
^
Start of string/line
$
End of string/line
\b
Word boundary
\B
Non-word boundary
Groups & Lookaround
(abc)
Capture group
(?:abc)
Non-capturing group
(?<n>abc)
Named group
\1
Backreference to group 1
a|b
Alternation (a or b)
(?=abc)
Positive lookahead
(?!abc)
Negative lookahead
(?<=abc)
Positive lookbehind
(?<!abc)
Negative lookbehind
Escapes
\.
Escaped special char
\n \r \t
Newline, CR, tab
\0
Null character
Replacement
$1 $2
Captured group
$&
Entire match
$`
Before match
$'
After match
$$
Literal $
JavaScript RegExp engine