ToolsMaxxing

Regex tester

Test a regular expression against your text and see every match, group and replacement.

Highlighted

Matches are highlighted here.

Matches

Enter a pattern and some text.

    Your files stay on your device

    How it works

    1. 1Type your pattern between the slashes and pick the flags.
    2. 2Paste the text you want to search.
    3. 3Read the highlighted text and the list of matches with their groups.
    4. 4Turn on Also test a replacement to try a replace string such as $1.

    What the options do

    Global (g)
    Find every match, not only the first.
    Ignore case (i)
    Letters match in either case.
    Multiline (m)
    ^ and $ match at the start and end of every line.
    Dot all (s)
    The dot also matches line breaks.
    Unicode (u)
    Treats the pattern as Unicode and allows \p{L} style classes.
    Sticky (y)
    Matches only at the position where the last match ended.

    Privacy

    Everything runs in your browser. What you paste is never sent to a server. Test data such as logs or customer lists stays on your device.

    Questions people ask

    Which regex flavour is this?

    JavaScript, as built into your browser. Most syntax matches other languages, but lookbehind, named groups and \p classes differ between flavours, so check the one you will ship with.

    What happens with a pattern that runs forever?

    The test runs in a separate worker. If it takes more than 1.5 seconds, it is stopped and you get a message. Patterns with nested repeats such as (a+)+$ are the usual cause.

    How do I see capture groups?

    Each match in the list shows numbered groups, and named groups written as (?<name>...) by their name.

    Why does it find an empty match?

    Patterns such as a* can match zero characters. Those matches are listed as empty and the search moves one character on so it never loops.

    How do I write the replacement?

    Use $1 for the first group, $<name> for a named group, $& for the whole match and $$ for a literal dollar sign.

    Related tools