Embed this tool on your site
<iframe src="https://devtoolbox.dedyn.io/tools/regex-visualizer" width="100%" height="700" frameborder="0" title="Regex Visualizer & Tester"></iframe>

Regex Visualizer & Tester

Visualize regular expression matches in real time. See highlighted results, capture group details, human-readable pattern explanations, and substitution output — all in your browser. See also the Regex Find & Replace Guide and Regex Builder.

/ /
g
i
m
s
u
 
Enter a regex pattern above to see highlighted matches.

Use $1, $2 for groups. $& for full match.

Substitution result appears here...
Character Classes
.Any char (not newline)
\dDigit [0-9]
\DNon-digit
\wWord [a-zA-Z0-9_]
\WNon-word char
\sWhitespace
\SNon-whitespace
[abc]Any of a, b, c
[^abc]Not a, b, c
[a-z]Lowercase letter
Quantifiers
*0 or more
+1 or more
?0 or 1
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?0+ (lazy)
+?1+ (lazy)
Anchors
^Start of string/line
$End of string/line
\bWord boundary
\BNon-word boundary
Groups & Lookaround
(abc)Capture group
(?:abc)Non-capturing
(?<n>..)Named group
\1Backreference
(?=..)Lookahead
(?!..)Neg. lookahead
(?<=..)Lookbehind
(?<!..)Neg. lookbehind
a|bAlternation
Flags
gGlobal (all matches)
iCase-insensitive
mMultiline ^ $
sDotall (. = \n)
uUnicode

Frequently Asked Questions

What is a regex visualizer and how does it help?
A regex visualizer shows you exactly how a regular expression matches text in real time. It highlights matched portions with colored backgrounds, displays capture groups with distinct colors, and breaks the pattern into human-readable explanations. This is much faster than trial-and-error in code. For a deep dive, see our Regex Find & Replace Guide.
What are the most common regex flags and when should I use them?
The most common flags are: g (global) to find all matches, i (case-insensitive) to ignore case, m (multiline) so ^ and $ match line boundaries, s (dotall) so dot matches newlines, and u (unicode) for full Unicode support. Use g when you need every occurrence, i for flexible text search, and m for multi-line input.
How do capture groups and backreferences work?
Capture groups are created with parentheses (). Each group saves its matched text numbered from 1. For example, (\d{3})-(\d{4}) matching "555-1234" gives group 1 = "555" and group 2 = "1234". In replacements, use $1, $2, etc. Try our Regex Builder to construct patterns visually.
Keyboard Shortcuts
Ctrl+Enter Test regex
Ctrl+Shift+C Copy matches
Ctrl+L Clear