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.
Contact us at hello@example.com or sales@test.org for details.
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.
Above the match list, the test string is redrawn with every match highlighted in place, so you can see at a glance whether the pattern grabs too much, too little, or the wrong occurrence. The optional Replace with field runs JavaScript's own String.replace with the same compiled pattern, so $1 and $2 insert numbered groups, $<name> inserts a named group, and $& inserts the whole match. What you see in the preview is exactly what your code will produce, including the difference between replacing the first match and replacing all of them with g.
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
- Type your pattern into the expression field (no surrounding slashes needed).
- Toggle the flags you need, such as g for all matches and i for case-insensitive.
- Paste the text to test into the Test string box.
- Check the highlighted copy of your text, then the matches list: each match shows its position, capture groups, and named groups.
- Optionally type a replacement such as $2-$1 or $<user> to preview the result of a find-and-replace.
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.
Input: Pattern (\w+)@(\w+)\.com with flag g and replacement $1 at $2, against 'hello@example.com'
Output: Replace preview: hello at example
Without the g flag only the first match is replaced, exactly as String.replace behaves in your code.
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, or that a replace only changed the first occurrence.
- Writing \1 in the replacement. JavaScript replacements use $1; \1 is a backreference inside the pattern itself.
- 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.
Related tools
More Developer tools that run entirely in your browser.