Regex Tester

Test regular expressions with live highlighting and capture groups.

//g
Highlighted matches
Contact us at hello@sparkjson.com or support@example.co.uk for help.
Matching runs in a background worker with a timeout, so a runaway pattern can't freeze this page.
Advertisement

About Regex Tester

Write a regular expression and see matches highlighted live in your sample text, with capture groups broken out individually. Toggle g/i/m/s flags, start from common presets like email or URL patterns, and matching is run with a timeout guard so a catastrophic-backtracking pattern can't hang your browser.

Regular expressions are matched on a background thread here, not the main one. That distinction matters because a regex engine can't be politely interrupted mid-search from the same thread it's running on — the only reliable way to stop a pathological pattern (the classic (a+)+$ style catastrophic backtracking case) is to run it somewhere you're allowed to forcibly terminate. If a match doesn't finish within about 1.5 seconds, the worker running it is killed outright and a fresh one takes its place for your next test.

Capture groups are broken out into their own column instead of being buried inside the raw match string, and named groups (?<year>\d{4}) show up labeled by name. The five presets (email, URL, phone, IPv4, hex color) are intentionally simple, readable patterns rather than the maximally 'correct' RFC-compliant versions, which tend to be unreadable and rarely what people actually want when testing input in practice.

Frequently asked questions

What happens if my regex hangs the matcher?
Matching runs inside a Web Worker with a hard timeout. If it doesn't return in about 1.5 seconds, the worker is terminated and you'll see a message suggesting the pattern may be causing catastrophic backtracking — your page itself never freezes, because the risky work never runs on the main thread to begin with.
Does this use JavaScript's regex engine or something else?
It uses your browser's native RegExp engine, so behavior matches exactly what you'd get in real JavaScript code — no separate regex flavor to translate later.
Why are my named capture groups showing as key=value pairs?
Named groups like (?<domain>[a-z.]+) are shown as domain=example.com in the groups column so you can tell them apart from the numbered, unnamed capture groups in the same match.