Regex Tester

Test regular expressions and see in real time which parts of your text match the pattern, with capture groups and highlighted matches.

Flags

0Matches
0Capture groups

The regex tester helps you build and debug regular expressions by showing, in real time, exactly which parts of your text the pattern captures. Type the expression, toggle the flags you need (global, case-insensitive, multiline and more), and paste a sample text: matches are highlighted instantly, and each one is listed with its capture groups and the position where it starts. It's an everyday tool for developers, people writing validation rules, doing find-and-replace in code editors, or extracting patterns from logs and spreadsheets — without relying on trial and error inside your own system.

How to use

  1. Type the regular expression in the pattern field (without the slashes — they're already shown around it).
  2. Toggle the flags you want, such as g to find every match or i to ignore case.
  3. Paste the test string and see the matches highlighted, with the list of matches and capture groups right below.

Practical example

Say you want to find every email address in a block of text. Using the pattern \b[\w.]+@[\w.]+\.\w+\b with the g flag, the tester highlights each address it finds — like contact@utilhub.com and support@mysite.com — and shows the index where each one begins. If you wrap a capture group around the domain — for example @([\w.]+) — the tool starts listing the isolated domain in group 1 for every match, handy when you only need that part.

Frequently asked questions

Which regex syntax does this tool use?

It uses the JavaScript regular expression engine (the same one your browser runs). Most of the syntax is shared with other languages, but some details — like named groups (?<name>...), lookbehind, and certain Unicode classes — follow JavaScript's specific rules and may differ from PCRE, Python or Java.

What do the g, i, m, s, u and y flags mean?

g (global) finds every match, not just the first; i ignores the difference between uppercase and lowercase; m (multiline) makes ^ and $ match at the start and end of each line; s makes the dot (.) also match line breaks; u enables Unicode mode; and y (sticky) only matches starting exactly at the current index position.

Do I need to include the slashes (/) in the expression?

No. Just type the pattern itself — the slashes that delimit the expression are already displayed around the field, and the flags appear after the closing slash automatically as you toggle them.

Does the tool show capture groups?

Yes. For each match it lists the numbered groups (capturing parentheses) as well as named groups when present. A group that didn't take part in the match is shown with a dash (—).

Are my pattern and text sent to a server?

No. Compiling the expression and searching for matches both happen locally in your browser — nothing you type in the pattern or the test string leaves your device.

Why can a pattern with * or ? produce empty matches?

Patterns that accept zero characters (like a* or (abc)?) can match an empty string at several positions in the text. The tool handles this safely, marks empty matches with a thin indicator, and advances the position so it never gets stuck in an infinite loop.