Tools Nimbus

Tool 010 / dev / free / runs locally

Regex Tester

Type a JavaScript regular expression and some sample text to see every match and capture group highlighted in real time. Toggle flags like global, ignore case, and multiline to fine-tune the pattern. Everything runs in your browser, so your data stays private.

//g
Matches (2)
at 14: hello@example.com
at 35: sales@test.org

How it works

This tester compiles your pattern with JavaScript's native RegExp constructor and runs it against your test string, listing every match with its start index, any numbered capture groups, and any named groups. Because it uses the browser's own engine, the syntax and behaviour are exactly what you will get in JavaScript or Node code, not a different flavour like PCRE or Python's re.

The flag buttons map to the standard JavaScript flags: g (global, find all matches), i (ignore case), m (multiline, so ^ and $ match line boundaries), s (dotall, so . matches newlines), u (unicode), and y (sticky). With g or y set, the tool iterates with exec to collect every match; without them it returns only the first. There is a built-in guard that breaks after 10000 matches and nudges past zero-width matches so the loop cannot hang.

If your pattern is invalid, the underlying syntax error is shown verbatim so you can fix it. Everything runs locally, so you can test patterns against private log lines or sample data safely.

How to use it

  1. Type your pattern into the expression field (no surrounding slashes needed).
  2. Toggle the flags you need, such as g for all matches and i for case-insensitive.
  3. Paste the text to test into the Test string box.
  4. Review the matches list: each shows its position, capture groups, and named groups.

Worked examples

Input: Pattern \b\w+@\w+\.\w+\b with flag g, against 'hello@example.com or sales@test.org'

Output: Two matches: hello@example.com at index 0 and sales@test.org at index 21.

The g flag makes it return every match rather than just the first.

Input: Pattern (?<year>\d{4})-(?<month>\d{2}) against 2026-06

Output: One match 2026-06 with named groups year: 2026 and month: 06.

Named groups appear under each match.

Edge cases and limits

  • This is the JavaScript regex flavour. Features from other engines like atomic groups, possessive quantifiers, or \A and \z anchors are not available.
  • Without the g or y flag only the first match is returned, which surprises people expecting a count.
  • Matching is capped at 10000 results to protect the page; pathological patterns on huge inputs can still be slow because regex backtracking is the cost, not the cap.
  • A zero-width pattern (one that can match the empty string) advances one character per step to avoid an infinite loop, so empty matches are reported at intervals rather than at every position.

Common mistakes

  • Wrapping the pattern in slashes, for example /abc/. Type just abc and use the flag buttons.
  • Forgetting the g flag and concluding the pattern only matches once.
  • Not escaping regex metacharacters like . or ? when you mean them literally; an unescaped dot matches any character.

Frequently asked questions

Which regex flavor does this tester use?+

It uses the JavaScript regular expression engine built into your browser, the same one used by Node.js and front-end code. Patterns that work here will behave the same in your JavaScript or TypeScript projects.

How do I see capture groups from my regex?+

Each match in the results list shows its full text plus every numbered capture group, and named groups when you use the named group syntax, so you can confirm your pattern extracts the right parts.

Why does my regex only return the first match?+

Without the global flag a regex matches once. Turn on the g flag to find every match in the text. The tester exposes g along with i, m, s, u, and y so you can control matching behavior.

More Developer tools that run entirely in your browser.