/ developer & network toolbox
← all tools

$ re

runs locally

Regex Tester

Test a JavaScript regular expression against sample text with live match highlighting and capture groups.

regex — invoker.tools

2 matches

foo@bar.com and info@example.com
@0foo@bar.com
@16info@example.com

JavaScript RegExp engine, runs in your browser.

About the Regex Tester

The regex tester lets you write a JavaScript regular expression, set its flags and run it against sample text with live match highlighting. As you type, it shows how many matches were found and breaks out each capture group, so you can see exactly what your pattern grabs.

Use it to build and debug regular expressions for validation, search-and-replace, log parsing or scraping before you drop them into code. Because it uses the same regex engine as the browser, the results match how your JavaScript will behave, and everything runs locally so your test data never leaves your machine.

How to use it

  1. Enter your regular expression pattern in the pattern field.
  2. Set flags such as g (global), i (case-insensitive) or m (multiline).
  3. Paste the sample text you want to test against.
  4. Review the highlighted matches, match count and captured groups.
  5. Adjust the pattern until the matches look right.

Examples

  • Pattern \d{4}-\d{2}-\d{2} with flag g highlights every ISO date in a block of text and reports the count.
  • Pattern (\w+)@(\w+) shows group 1 as the local part and group 2 as the domain for each email match.
  • Use the i flag to match Error, error and ERROR in a log file regardless of case.

Frequently asked questions

What regex flavor does this tester use?

It uses JavaScript (ECMAScript) regular expressions, the same engine your browser runs, so behavior matches what you would get in JS code.

How do I capture groups?

Wrap part of your pattern in parentheses, like (\d+), and the tool lists each captured group separately for every match.

Is my test text uploaded anywhere?

No. The pattern and sample text are evaluated entirely in your browser and never sent to a server.

Why isn't my global match finding everything?

Make sure the g flag is set. Without it, only the first match is returned; with it, the tester highlights and counts all matches.

Can I use named groups and lookbehind?

Yes, as long as your browser supports them. Modern browsers handle named groups and lookbehind, since the tool relies on the native engine.

What is the difference between this and a server-side regex tester?

This runs client-side using the JavaScript engine, so results reflect JS semantics exactly and your data stays local, unlike testers that target PCRE or other flavors on a server.

More text tools