Regex Tester

Test and debug regular expressions live. Runs entirely in your browser.

g · Global — find all matches, not just the first
First match
No match.
All matches (0)
—

Results are for reference only. Behavior depends on the selected flags.

Test JavaScript regular expressions against sample text with live highlighting and capture group inspection, before the pattern reaches production.

Flags change everything

The global flag continues matching after the first hit; without it you only ever see the first match. The multiline flag makes anchors match at line boundaries instead of only at the start and end of the whole string, which is the difference between matching one line and matching nothing.

The dotAll flag lets the dot match newlines. Without it, a pattern like start.*end silently fails across line breaks, which is one of the most common reasons a regex that works in a test file fails on real input.

Catastrophic backtracking is a real outage

Nested quantifiers such as (a+)+b can take exponential time on a non-matching input. A short string of twenty a characters followed by a c can hang the JavaScript thread for minutes. This is the mechanism behind regex denial-of-service, and it has taken down production services.

The mitigation is to avoid nesting quantifiers, anchor the pattern where possible, and bound repetition with explicit maxima. Testing on adversarial input matters more than testing on the happy path.

Lookarounds and flavour differences

JavaScript supports lookahead and lookbehind, so patterns like a price not preceded by a dollar sign are expressible. What it does not support is atomic grouping or possessive quantifiers, which are the usual cure for backtracking blowups.

Patterns written for PCRE, Python or Java often fail here for that reason. Named groups exist but use the (?<name>...) syntax rather than Python's (?P<name>...).

Frequently asked questions

Why does the same regex work in Python but not here?
Different flavour. This tool runs the JavaScript engine, which lacks atomic groups and possessive quantifiers and uses different syntax for named groups.
How do I see capture groups?
Matches are listed with their numbered groups. Named groups appear under their names.
Can I test very long text?
Yes, but a pathological pattern on long input can freeze the tab. If the page stops responding, the pattern is the problem, not the length.