Regex Tester

Write a regular expression and test it against any string with live match highlighting. See all matches, capture groups and group names at a glance. Uses JavaScript's native RegExp engine. Runs entirely in your browser.

/ /
0Matches
0Groups
Highlighted matches

Regex Quick Reference

PatternMatches
.Any character except newline
\dDigit (0–9)
\wWord character (a–z, A–Z, 0–9, _)
\sWhitespace (space, tab, newline)
^Start of string / line
$End of string / line
*0 or more of the previous
+1 or more of the previous
?0 or 1 of the previous (optional)
{n,m}Between n and m repetitions
(abc)Capture group
a|ba or b
[abc]Character class (a, b or c)
[^abc]Not a, b or c

Common Regex Patterns

Use casePattern
Email address[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}
URLhttps?://[^\s]+
IPv4 address\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
Date YYYY-MM-DD\d{4}-\d{2}-\d{2}
Hex color#[0-9a-fA-F]{3,6}

Frequently Asked Questions

What flavor of regex does this tester use?

JavaScript's built-in RegExp engine, which supports character classes, quantifiers, groups, lookaheads and backreferences.

What do the regex flags mean?

g = find all matches; i = case-insensitive; m = multiline (^ and $ match line boundaries); s = dotAll (dot matches newlines).

How do I match a literal dot or bracket?

Escape with a backslash: \. for a literal dot and \[ for a literal bracket.

What is a capture group?

A part of the pattern in parentheses, e.g. (\d+). The matched substring is captured and can be referenced in replacements as $1, $2, etc.