Developer Tools

Regex Tester

Test a regular expression against your text and see every match highlighted live.

Rate this tool

How to use the Regex Tester

  1. Enter your regular expression.
  2. Paste the text to test it against.
  3. See the matches highlighted, with capture groups listed below.

About the Regex Tester

This tester compiles the regular expression you type — with whichever flags you tick — using your browser’s own built-in JavaScript RegExp engine. Global (g) finds every match rather than just the first, ignore case (i) makes letters case-insensitive, multiline (m) lets ^ and $ match at the start and end of each line, and dotall (s) lets . match newline characters too. It then lists each match with its position and any capture groups, and re-shows your test text with every match highlighted.

It is the quickest way to check that a pattern does what you think before you drop it into code, a validation rule or a find-and-replace. One honest catch: this uses JavaScript regex syntax specifically, which differs in places from PCRE, Python or Java — lookbehind, named groups and the exact meaning of \d are not always identical — so a pattern that works here may need tweaking elsewhere. To keep the display snappy it lists at most 50 matches, steps past zero-length matches so an empty pattern cannot loop forever, and shows the engine’s own error message if your pattern will not compile.

Everything runs entirely in your browser, so your pattern and test text are never uploaded and you can safely try them against real data. For bulk substitutions try find and replace, or compare two blocks of text with text compare.

Frequently asked questions

Which regex flavour does this use?

It uses your browser’s built-in JavaScript RegExp engine. That differs in places from PCRE, Python or Java — things like lookbehind, named groups and the exact meaning of shorthand classes are not always identical — so a pattern that matches here may behave differently in another language.

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

Global (g) returns every match instead of just the first; ignore case (i) matches letters regardless of case; multiline (m) makes the anchors match at the start and end of each line rather than the whole string; and dotall (s) lets the dot match newline characters as well.

Why does it stop listing after 50 matches?

The list is capped at 50 entries so the page stays fast on very large inputs. The match count above the list still reflects the true total; only the detailed per-match list is trimmed.

Why does my pattern show an invalid-expression error?

The pattern could not be compiled by the JavaScript engine — usually an unbalanced bracket or parenthesis, a stray backslash, or a construct that flavour does not support. The exact engine error message is shown so you can see what it objected to.

Is my pattern or test text sent to a server?

No. The matching happens entirely in your browser using the built-in engine, so nothing you type is uploaded, logged or stored. You can test against real or sensitive data safely.