noupload
0 bytes uploadedNothing processed yet

Test regular expressions without uploading your text

Build and debug a pattern with live results. Matches are highlighted, groups are listed and a replacement preview shows what your pattern would change. Your text stays on your device.

  • No sign-up
  • No watermark
  • No daily limits
  • Works on phones too
  • Data sent by this page: 0 bytes
Flags

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

Quick reference
.any character except a line break
\d \w \sa digit, a letter or digit, a space
^ $the start and the end
* + ?zero or more, one or more, optional
{2,4}between 2 and 4 times
(…) (?<n>…)a group, a named group
[abc] [^abc]any of these, none of these
a|ba or b

Matches highlighted

Result of the replacement

Match details

    How to test a regular expression

    1. Type your pattern in the first box. A sample that finds dates is loaded.
    2. Choose the flags you need. The g flag finds every match, and without it only the first one is found.
    3. Type or paste your test text. Matches are highlighted and listed below with their position and groups.
    4. To try a replacement, type it in the replace box. Use $1 for a group or $<name> for a named group.

    Questions people ask

    Which regular expression flavour does this use?

    JavaScript, the one built into your browser. It is close to other flavours but not identical. For example, it has no atomic groups, and lookbehind support depends on the browser.

    What do the flags mean?

    g finds every match instead of the first, i ignores upper and lower case, m lets ^ and $ match at each line, s lets the dot match a line break, and u turns on full Unicode support.

    Why was my pattern stopped?

    Some patterns, such as (a+)+$ on a long run of letters, make the engine try an enormous number of combinations. This is called catastrophic backtracking. The test runs in a separate worker that is stopped after a moment so your page never freezes.

    How do I use groups in a replacement?

    Put parentheses around the part you want, then write $1 for the first group, $2 for the second, and $<name> for a named group such as (?<year>\d{4}). $& stands for the whole match.

    Why do I only get the first match?

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

    How do I match a dot, a bracket or a dollar sign?

    Put a backslash before it. A pattern of \. matches a literal dot, \( matches a bracket and \$ matches a dollar sign. Inside square brackets most of these need no backslash.

    Is my pattern or test text uploaded?

    No. The pattern runs in your browser, in a worker on your device. Nothing is sent to a server, so you can test it on real logs and data.