Regex Tester
Write and test regular expressions live.
Matches highlight as you type. Capture groups, named groups, flags, and replace mode — all local, all instant.
Runs locally. Your patterns and test strings never leave your browser.
/
/
Flags
Matches
Characters
.Any character except newline
\dDigit [0–9]
\wWord char [a–zA–Z0–9_]
\sWhitespace
\D \W \SNegated versions
Quantifiers
*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
{n,m}Between n and m times
*? +?Lazy (non-greedy)
Anchors & boundaries
^Start of string (or line with m)
$End of string (or line with m)
\bWord boundary
\BNot a word boundary
Groups
(abc)Capturing group
(?<n>)Named group
(?:abc)Non-capturing group
(?=abc)Lookahead
(?!abc)Negative lookahead
Character classes
[abc]a, b, or c
[^abc]Not a, b, or c
[a-z]a through z
[a-zA-Z]Any letter
Replace tokens
$1 $2Group by index
$<name>Named group
$&Entire match
$`Before match
$'After match
How it works
Pattern matching in plain English.
What regex does
A regular expression is a pattern that describes a set of strings. Write a pattern once and match it against any amount of text — emails, phone numbers, log lines, dates, URLs.
Capture groups
Wrap part of your pattern in parentheses to capture it separately. Named groups ((?<name>...)) make the output readable. Use $1 or $<name> in replace to reference them.
Flags change behaviour
g finds all matches. i ignores case. m makes ^ and $ match line boundaries. s lets . match newlines. u enables full Unicode support.
Looking for something else?
Check out our other privacy, everyday, and developer tools.
Browse all tools →