Regex tester

Write a regular expression and see every match highlighted as you type, with capture groups, named groups and a replace preview. Uses JavaScript’s regex engine, in your browser.

Loading…

How it works

  1. 1

    Write the pattern

    Type it without slashes and switch flags on or off: global, ignore case, multiline, dot-all, unicode and sticky. Syntax errors are explained as you type.

  2. 2

    Paste test text

    Matches are highlighted in place and listed below with their position and every capture group, numbered and named.

  3. 3

    Try a replacement

    Use $1,

    lt;name> and
    amp; to preview what String.replace would produce, then copy the result.

Questions

Which regex flavor is this?
JavaScript (ECMAScript), as in Chrome, Node.js and every browser. It is close to PCRE for everyday patterns; lookbehind, named groups and \p{…} Unicode classes all work.
Why does my pattern freeze other testers?
Patterns like (a+)+$ can take exponential time on some inputs (catastrophic backtracking). Here the regex runs in a background worker and is stopped after 1.5 seconds, so the page stays responsive and you’re told why.
How many matches are shown?
Up to 10,000, which is enough for any text you’d check by eye. The count tells you if there are more.
Is my text uploaded?
No. Matching happens in this tab.