enthu tools

Regex Tester

Test JavaScript regular expressions live and read every token explained in plain English. Capture groups, replace and share links. Free, no ads, no sign-up.

Runs in your browser Free, no sign-up No ads

Cheat sheet click a token to insert it

Characters

Anchors

Repeat

Groups

Lookaround

Unicode (u flag)

Replace each match with new text, using $1 or $<name> for groups.

Explanation hover a row to find it in the pattern
      Matches

      How to use Regex Tester

      1. Type your regular expression in the pattern box, without the surrounding slashes, and switch on the flags you need: g for every match, i to ignore case, m for line anchors.
      2. Paste the text to test in the box below. Every match is highlighted as you type, each capture group in its own colour, and the match list shows every group's index, name and value.
      3. Read the explanation tree: each row says in plain English what one token does. Hover a row to see that token light up in your pattern.
      4. Switch on Replace and write the replacement, using $1 or $<name> for groups, to see the result live. Press Copy link to share the pattern, flags and text.

      Regex quick reference

      . is any character, \d a digit, \w a letter, digit or underscore and \s whitespace; the capitals \D \W \S mean the opposite. [abc] is one of the listed characters and [^abc] anything else. *, + and ? repeat the item before them zero or more, one or more, or zero or one times, and {2,5} sets the count; add ? to make any of them lazy. ( ) captures a group, (?<name> ) names it and (?: ) groups without capturing. ^ and $ anchor to the start and end, and (?=...) or (?<=...) look ahead or behind without consuming text.

      Questions

      Is the explanation really free?

      Yes. The full token-by-token explanation, the replace preview and the share links are free, with no ads, no account and no paid tier. There is nothing to upgrade to.

      Which regex flavour does it use?

      JavaScript, run by your own browser's engine, so what matches here matches in your JavaScript or TypeScript code. When you type syntax that only PCRE or Python understands, such as (?P<name>...), (?i) or a++, the explanation says so and shows the JavaScript way.

      Is my text sent to a server?

      No. Matching runs in your browser. Share links keep the pattern and text after the # in the URL, a part browsers never send to a server, so only people you give the link to can see it.

      What happens if my pattern hangs?

      Matching runs in a background worker with a time limit. A pattern with catastrophic backtracking, such as (a+)+$ on a long line, is stopped after a second and a half with a message, and the page stays responsive.

      How do I use capture groups in the replacement?

      Write $1, $2 and so on for numbered groups, $<name> for named groups, $& for the whole match and $$ for a dollar sign. Without the g flag only the first match is replaced, exactly as String.replace does.

      What do greedy and lazy mean?

      A greedy quantifier such as .* takes as much text as it can and gives some back only if the rest of the pattern needs it. A lazy one, written .*?, takes as little as possible. The explanation labels every quantifier as one or the other.

      Why does \p{L} match the letter p?

      Unicode property escapes such as \p{L} only work with the u flag. Without it JavaScript reads \p as a plain p. Turn on u and \p{L} matches any letter in any language.

      Related tools