This regex tester runs JavaScript regular expressions against your text and shows every match, its position and its capture groups. Patterns are evaluated locally, so nothing is uploaded or logged.
Your data is processed locally in your browser and is not uploaded to our server.
Invalid pattern:
Matches (2)
Contact ada@example.com or grace@example.org for details.
No matches in this text.
#1ada@example.comat 8
#2grace@example.orgat 27
How to use this tool
1 Enter a regular expression and choose the flags you need.
2 Paste the text to search; matches are highlighted and listed as you type.
3 Pick one of the common examples to start from a working pattern.
4 Copy the matched values or clear the form.
Formula and calculation logic
Matching
new RegExp(pattern, flags).exec(text)
The pattern is compiled by the browser’s JavaScript engine. Without the g flag only the first match is returned; with g, the tester keeps matching until the end of the text.
Flags
g global · i ignore case · m multiline · s dotAll · u unicode · y sticky
Flags change how the engine interprets the pattern. The tester passes them to the RegExp constructor and reports syntax errors with the engine’s message.
Worked example
Find email addresses
A support message contains two email addresses.
Pattern: \b[\w.+-]+@[\w-]+\.[\w.]+\b
Flag: g
Result: ada@example.com and grace@example.org
Each match is listed with its start index; capture groups are shown when the pattern has parentheses.
Capture a date
Extract year, month and day from ISO dates.
Pattern: (\d{4})-(\d{2})-(\d{2})
Flag: g
Groups: year, month, day for each match
Parenthesised parts are returned as capture groups in the order they appear in the pattern.
Edge cases and accuracy
Catastrophic backtracking
Nested quantifiers such as (a+)+ can make the engine work exponentially on some inputs. If the page stalls, simplify the pattern; the tester cannot interrupt a running regex.
Zero-length matches
Patterns like ^ or \b can match an empty string. The tester advances the search position after an empty match so it does not loop forever.
JavaScript syntax only
The tester uses JavaScript RegExp syntax, not PCRE or Python syntax. Lookbehind and named groups are supported only in engines that implement them.
Frequently asked questions
Why do I get only one match?+−
The g (global) flag is required to find every match. Without it, the tester stops after the first result.
What are capture groups?+−
Each parenthesised part of the pattern captures text. Groups are numbered from left to right and shown next to the match, with ∅ for an unmatched optional group.
Are my pattern and text uploaded?+−
No. Matching runs in your browser with the native RegExp engine; nothing is sent to a server.
Why is my regex slow?+−
Nested quantifiers and ambiguous alternations can cause catastrophic backtracking. Rewrite the pattern to be more specific or anchor it to reduce the search space.
Does it support named groups?+−
The engine passes modern JavaScript syntax through, so named groups work where the browser supports them. The result list shows numbered groups.