Regex Tester
Test a regular expression against sample text locally: see every match, its position and its capture groups. Runs in your browser with input length caps for safety.
Loading calculator…
What this tool does
Test a regular expression against sample text locally: see every match, its position and its capture groups. Runs in your browser with input length caps for safety. JavaScript (ECMAScript) regex flavour — no lookbehind restrictions beyond your browser, no PCRE features. Pattern is capped at 200 characters and test text at 5,000; zero-width matches are advanced manually so iteration always terminates.
How to use the Regex Tester
- Enter or select regular expression pattern.
- Enter or select flags (g, i, m, s, u, y).
- Enter or select test text.
- Read the calculated result; change any measurement to compare alternatives.
Formula
Compile with the RegExp constructor using the supplied flags; iterate matches (forcing global iteration) and report each match's index and capture groups.
- pattern
- Regular expression pattern
- flags
- Flags (g, i, m, s, u, y)
- test
- Test text
JavaScript (ECMAScript) regex flavour — no lookbehind restrictions beyond your browser, no PCRE features. Pattern is capped at 200 characters and test text at 5,000; zero-width matches are advanced manually so iteration always terminates.
Worked example
For regex tester, the following measurements illustrate the exact method: Regular expression pattern: \d+; Flags (g, i, m, s, u, y): g; Test text: Order 42 ships in 3 days, tracking 90210..
Inputs
- Regular expression pattern\d+
- Flags (g, i, m, s, u, y)g
- Test textOrder 42 ships in 3 days, tracking 90210.
Result
- Match count3
- Matches42 | 3 | 90210
Results explained
- Match count
- Match count from the formula above. JavaScript (ECMAScript) regex flavour — no lookbehind restrictions beyond your browser, no PCRE features. Pattern is capped at 200 characters and test text at 5,000; zero-width matches are advanced manually so iteration always terminates.
- Matches
- Matches from the formula above. JavaScript (ECMAScript) regex flavour — no lookbehind restrictions beyond your browser, no PCRE features. Pattern is capped at 200 characters and test text at 5,000; zero-width matches are advanced manually so iteration always terminates.
Frequently asked questions
JavaScript's RegExp engine, exactly as your browser implements it. Most everyday patterns behave the same as in editors and other languages, but PCRE-only features (like \K or possessive quantifiers) are not supported.
The results table lists each match with its index and numbered groups ($1, $2, ...). Unmatched optional groups are shown as (none).
Pathological patterns (catastrophic backtracking, e.g. nested quantifiers on long failing input) can block any regex engine. Inputs are length-capped (200-char pattern, 5,000-char text), but you should still avoid patterns like (a+)+$ on untrusted text anywhere.
g = find all matches, i = case-insensitive, m = multiline ^/$, s = dot matches newlines, u = Unicode-aware, y = sticky. This tester iterates all matches even without g so you can see every hit.
No. Matching runs locally in your browser.