Regex Tester

Type a regular expression and some test text: matches are highlighted instantly, with their groups, and you can try out a replacement. It uses your browser's JavaScript engine, and your text never leaves your device.

🔒 What you type never leaves your device. Everything is calculated in your browser.

Options (flags)
Try an example

Highlighted matches

Matches

    Use $1, $2… for groups, $& for the whole match and $<name> for named groups.

    How to test a regular expression

    1. Type the expression in the first field, without the surrounding slashes.
    2. Check the options you need, such as ignoring case or finding all matches.
    3. Paste your test text: matches are highlighted and listed with their groups.
    4. If you like, type a replacement and copy the resulting text.

    What a regex tester is for

    A regular expression (regex) is a pattern for searching, validating or replacing text: emails, phone numbers, dates, codes. Testing it before using it in your code saves you errors and time.

    This tool uses the JavaScript regular expression engine, the same one in your browser and in Node.js. It marks every match in the text and shows the value of each capture group, including named ones.

    The replacement supports $1, $2 and the rest of the JavaScript syntax, so it is useful for preparing a bulk change before applying it.

    Things to keep in mind

    Frequently asked questions

    What do the g, i, m, s and u flags mean?

    g finds all matches, not just the first. i ignores uppercase and lowercase. m makes ^ and $ apply on every line. s lets the dot match line breaks. u turns on Unicode mode.

    Which language is it compatible with?

    JavaScript. The basic constructs (classes, groups, quantifiers, anchors) are the same in almost every language.

    How do I use groups in the replacement?

    Use $1, $2, etc. for numbered groups, $& for the whole match and $<name> for named groups.

    Is my text sent to any server?

    No. Everything happens in your browser and your text never leaves your device.

    Is it free?

    Yes, it is free, requires no sign-up and works directly in your browser.