Regex Tester

Test regular expressions against sample text, with live match highlighting and group capture details.

Runs in your browser. Your input stays on this device.

Flags
Regex quick reference

Anchors

^Start of string (or line with m flag)
$End of string (or line with m flag)
\bWord boundary (between a word char and a non-word char)

Character shortcuts

.Any character except newline (enable s flag to include newline)
\dDigit — same as [0-9]
\wWord character — same as [a-zA-Z0-9_]
\sWhitespace — space, tab, newline
\D \W \SThe opposite of the above (non-digit, non-word, non-space)

Quantifiers (how many times)

*Zero or more
+One or more
?Zero or one (makes the preceding part optional)
{3}Exactly 3 times
{2,5}Between 2 and 5 times

Groups and sets

(abc)Capture group — the matched text appears in the Groups section
(?:abc)Non-capturing group — groups without capturing
[abc]Character set — matches a, b, or c
[^abc]Negated set — matches anything except a, b, or c
[a-z]Range — matches any lowercase letter a through z
a|bAlternation — matches a or b

Flags (checkboxes above)

gGlobal — find all matches, not just the first
iCase insensitive — FOO matches foo
mMultiline — ^ and $ match start/end of each line
sDot-all — makes . match newlines too

Example patterns to try

\d+One or more digits
\b\w+\bEach whole word
[A-Z][a-z]+Capitalized words
\w+@\w+\.\w+Simple email-like addresses
https?://\S+URLs starting with http or https

Common questions

Quick answers before you use this tool.

Runs in your browser. Your input stays on this device.
No account is required. Open the tool and use it right away.
Yes. Enable the global flag (g) to find every match in the test string, with each match shown individually in the results list.