Code

Regular Expression Tester

Shows every match of a pattern with its line, position and capture groups.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Put the text you want to search in the first box.
  2. Put the regular expression in the second box, without the surrounding slashes.
  3. Turn on ignore case or multiline if your pattern needs them.
  4. Select Test, and read the group columns to see which part of the pattern caught what.

What regex tester does

Put your text in the first box and the pattern in the second. Every match comes back with the line it is on, its position in the text and the contents of each capture group, numbered and named, so you can see which part of the pattern caught which part of the text rather than guessing from the whole match.

Two things are called out because they are the usual causes of a pattern that seems not to work. Empty matches are flagged, since a pattern that can match nothing will match everywhere and is nearly always missing a quantifier. And the flags are shown in the summary, because case sensitivity and whether ^ means start of line or start of text change the answer completely.

Frequently asked questions

JavaScript’s, because it runs in your browser. That covers the common syntax — character classes, quantifiers, lookahead, named groups — but not Perl or PCRE extensions such as recursion or possessive quantifiers, and \A and \z are not supported.

Check the flags first, because they are the usual cause: matching is case sensitive unless you turn that off, ^ and $ mean the start and end of the whole text unless multiline is on, and a dot will not cross a line break unless you let it.

Because a pattern that can match nothing matches at every position, which produces a long and useless result. It nearly always means a quantifier is wrong — a * where a + was meant, or a group that is entirely optional.

No. The pattern is compiled and run in your browser, so log files and production data can be pasted here without leaving the machine.