Regex Tester 🔒 Your data never leaves your browser.

Test patterns with live highlighting. Freeze-proof via Web Worker.

//g
#MatchPositionGroups

Use $1, $2 for capture groups and $<name> for named groups.

    About this tool

    This tester runs your pattern with the same JavaScript engine your code uses — matches here match in Node.js and every browser. Matches highlight as you type, with numbered and named capture groups listed per match.

    Patterns execute in a Web Worker with a 2-second kill switch, so a catastrophically backtracking pattern like (a+)+$ cannot freeze the tab. Want a pattern library and cheatsheet too? Visit our dedicated regexcheck.com.

    Frequently asked questions

    Why does my pattern behave differently without the "g" flag?

    Without "g", JavaScript's regex engine stops after the first match. The tester enables "g" by default so the table and highlights show every occurrence in your text — turn it off to see how a first-match-only pattern behaves.

    What happens if I write a pattern that hangs — catastrophic backtracking?

    It runs inside a separate Web Worker with a timeout. If matching doesn't finish quickly, the tester kills the worker and shows an error instead of freezing the page.

    How do I reference capture groups in the replacement text?

    Use $1, $2, and so on for numbered groups in the order they appear, or $<name> for a named group like (?<year>\d{4}). The Replace tab previews the substituted text live as you type.

    What does the Explain tab actually do?

    It breaks your pattern into individual tokens — anchors, quantifiers, groups, character classes, and so on — and describes what each one matches. That's useful for understanding a pattern someone else wrote, or for debugging your own.

    Is my test text or pattern sent to a server?

    No. Matching runs locally in a Web Worker inside your browser — the pattern and text you enter are never uploaded anywhere.