Regex Tester

Test JavaScript regular expressions with live match highlighting.

Matches

    How to use the regex tester

    1. Type a pattern into Regular expression, without the surrounding slashes.
    2. Set flags by ticking them or typing them, for example g for all matches and i to ignore case.
    3. Paste text into Test string, or press Sample. Every match is highlighted, and Matches lists each one with its numbered and named groups.
    4. Fill in Replace with to preview String.replace; $1 and $<name> refer to groups.

    Example

    The pattern (\d{4})-(\d{2})-(\d{2}) with the g flag finds both dates inReleased 2026-10-27, patched 2026-11-02, with year, month and day as groups 1 to 3. Replacing with$3/$2/$1 gives Released 27/10/2026, patched 02/11/2026.

    Frequently asked questions

    Which regex flavor is this?

    JavaScript (ECMAScript) regular expressions, the same engine as your browser and Node.js. Lookbehind, named groups(?<name>…) and Unicode property escapes \p{L} are supported. Syntax differs slightly from PCRE, Python and Java.

    Why is only the first match found?

    Without the g flag a regular expression stops at the first match. Tick g to find them all.

    Is my test text uploaded?

    No. Matching runs in your browser as you type.