Regex Tester

Test a pattern against real sample text.

How to use Regex Tester

  1. Enter a pattern. Type your regular expression into Pattern, without the surrounding slashes.

  2. Select flags. Tick any of g, i, m, s, u and y under Flags. Hover a flag to see what it does. g and i are on by default.

  3. Add sample text. Paste the text to test into Sample text.

  4. Read the matches. See the match count, the highlighted text and a Matches list showing each match, its index and its capture groups, including named groups.

Limits and privacy

  • The tester uses your browser's built-in JavaScript RegExp engine, so syntax and behavior follow JavaScript, not PCRE, Python or other flavors.
  • At most 5,000 matches are returned for any pattern and text.
  • The search also stops after a bounded number of iterations (about four times the text length) to protect the page from runaway patterns.
  • Without the g flag, only the first match is shown.
  • An empty pattern shows a prompt instead of a result, and invalid patterns show the engine's error message.
  • Testing runs in your browser. Nothing is uploaded.

Frequently asked questions

Which regex flavor does this use?

JavaScript (ECMAScript) regular expressions, using the same RegExp engine as your browser.

Why do I only see one match?

The g flag is probably off. Without it the tester returns only the first match. Tick g to find all matches.

Does it show capture groups?

Yes. Numbered groups are listed as Group 1, Group 2 and so on, and named groups appear under their names.

Is there a match limit?

Yes, 5,000 matches. Results beyond that are not shown.

What's next