Skip to content

Regex Tester

Test a regular expression live with match highlighting and capture groups.

Runs locally in your browser.

Any of g i m s u y.

How do you test a regular expression?

Paste a pattern and your text to see matches highlighted live. The pattern is compiled with the JavaScript RegExp engine: with the g flag every match is found, without it only the first, and capture groups are shown per match. For example, \d+ with the g flag finds 12 and 345 in "a12b345". Everything runs in your browser.

Understanding your result

This uses the same regex engine as your browser and Node.js, so patterns behave exactly as they will in JavaScript.

Formula and method

The pattern is compiled with the JavaScript RegExp engine. With the g flag every match is found; without it, only the first. Capture groups are shown for each match.

Worked example

The pattern \d+ with the g flag finds 12 and 345 in “a12b345”.

How to use this tool

  1. Enter your pattern (without slashes).
  2. Add any flags, such as g for global or i for case-insensitive.
  3. Paste a test string and read the highlighted matches.

Common mistakes to avoid

  • Wrapping the pattern in slashes — enter the pattern only, and put flags in the flags box.
  • Forgetting the g flag when you want all matches, not just the first.

About the Regex Tester

Test a regular expression against any text and see the matches highlighted instantly, with capture groups and a match count. Everything runs in your browser.

Who should use this tool

Developers writing and debugging regular expressions for validation, search or parsing.

Explore all Developer Tools tools

Frequently asked questions

Which flavour of regex is this?

JavaScript (ECMAScript) regular expressions, matching how they run in browsers and Node.js.

Are capture groups supported?

Yes. Each match lists its captured groups in order.

Share this tool

Free to use — copy the link, share it anywhere, or add the tool to your own website.

Embed this tool on your site (free)

Copy this code and paste it into any web page — it stays free and always up to date: