🔍Regex Tester

Test regex pattern matches on text

How to use the regex tester

A regular expression changes meaning completely when a single character is wrong, so it pays to try it against real text before it goes anywhere near your code. Enter the pattern body without slashes, paste the text underneath, and you get the number of matches, the index of each one and the value of every capture group. Named groups are listed by name.

Flags are toggled with the checkboxes. The g flag finds every match, i ignores case, m makes the anchors match at the start and end of each line, s lets the dot match newlines, and u turns on unicode mode so emoji and property escapes such as \p{L} work. When the pattern itself is invalid you get the browser parser message exactly as it was raised instead of a result.

Some patterns slow down dramatically as the input grows, a problem known as catastrophic backtracking. To keep the page responsive the text is limited to 20,000 characters, the pattern to 500 characters, and matching stops after 5,000 matches, of which the first 200 are listed. Indexes are zero based, so a match on the very first character is reported as 0. Everything runs inside your browser.

Frequently asked questions

Should the pattern be wrapped in slashes?

No. Enter the pattern body only. Flags are chosen with the checkboxes, so there is no need to append g or i at the end either.

Why does matching stop at 5,000 results?

Matching is capped at 5,000 results so the browser stays responsive on large inputs. If you need more, split the text and test it in parts.