Regular Expression Tester

Test regular expressions against your text with live match highlighting. Shows every match, its index and capture groups.

Flags

Common flags

FlagMeaning
gGlobal — find all matches, not just the first
iCase-insensitive
mMultiline — ^ and $ match at line boundaries
sDotall — . also matches newlines
uUnicode — enable full Unicode support (needed for \p{...})
ySticky — match only at the last successful position

Useful patterns

# Email (pragmatic, not RFC-complete)
[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}

# ISO date
\d{4}-\d{2}-\d{2}

# Hex colour
#(?:[0-9a-fA-F]{3}){1,2}\b

# IPv4
(?:\d{1,3}\.){3}\d{1,3}

# URL
https?:\/\/[^\s/$.?#].[^\s]*

# Named capture group
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})

Performance warning

Catastrophic backtracking is real. A pattern like (a+)+$ against a long run of a characters followed by a non-matching character can hang the browser for minutes. When a regex feels slow, look for nested quantifiers — a + or * inside a group that is itself quantified.

If you need a timeout or progress reporting for complex patterns, run the matching in a Web Worker so the UI stays responsive.

Related

Working with structured data instead? The JSON formatter validates and beautifies payloads.

Frequently asked questions

Is my text uploaded anywhere?

No. The pattern is compiled and matched in your browser.

What do the flags mean?

g for global, i for case-insensitive, m for multiline, s for dot-matches-newline, u for full Unicode, and y for sticky matching.

Why does my regex hang the browser?

Almost always catastrophic backtracking. Look for nested quantifiers — a + or * inside a group that is itself quantified — and rewrite them to be unambiguous.

What is the difference between a capture group and a named one?

A capture group is referenced by number, (...) as $1. A named group, (?<name>...), is referenced by name, which is far easier to maintain in a large pattern.

Can I use it to test a pattern against a huge file?

It is designed for snippets. For large files, use a dedicated tool such as grep with -P, or ripgrep.