Regex Tester

//

Cmd/Ctrl+Enter saves this pattern to history.

Advertisement

Test a pattern against sample text and see every match highlighted, with numbered and named capture groups broken out individually, plus a live replace preview. Matching always runs in global mode, so you see every occurrence in the input, not just the first.

Frequently asked questions

Does this find only the first match, or every match?
Every match. The g flag is applied internally even if you don't type it, since without it a JavaScript regex only ever finds the first occurrence. Matching is capped at 1000 results, which only matters for pathological patterns against very large input.
Why does a pattern like /x*/ not freeze the page?
Patterns that can match a zero-length string (like x* or a lookahead-only pattern) would loop forever at the same position under naive global matching. This tool detects a zero-width match and advances one character before continuing, so it terminates instead of hanging.
Can I see named capture groups, not just numbered ones?
Yes. Named groups — (?<year>\d{4}) — appear alongside numbered groups, each with its own matched value and start/end position in the input.
Is my input uploaded anywhere?
No. Matching happens locally in your browser tab — nothing is sent to a server.

Read the full guide for this tool →

Advertisement