Developer tools TOOL
Regular expression tester
Inspect matches and groups in a JavaScript regular expression.
Enter your text
On-device processingRegular expression tester · How to use
Inspect matches and groups in a JavaScript regular expression.
Example
Apply \d+ with the g flag to one 123 two 456 to match 123 and 456.
Things to know
Uses JavaScript regular expressions. Syntax can differ from PHP and Python; long-running tasks can be cancelled.
Output options
Your files and results are never sent to a server. Everything is processed in this browser.
How to check that a regular expression matches what you expect
Confirm that a pattern catches only the strings you intend before it goes into code, or refine a pattern that pulls order numbers or dates out of a log. Each result shows the matched text, where it starts, and the value of every parenthesized group.
When to use this tool
- Confirm a validation pattern accepts only intended values
- Refine capture groups that extract dates from logs
- Inspect the output of named groups (?<name>…)
- Compare how the i and m flags change matches
Step-by-step instructions
- Enter the text you want to search.
- Type only the pattern in the Regular expression field, without surrounding slashes. Example: \d{4}-\d{2}-\d{2}
- Enter the Regular expression flags. Include g to find every match.
- Choose Convert and read the match, index, and groups values in the result.
Frequently asked questions
Why do I get only one match without the g flag?
Without g, the search stops at the first match. Add g to the flags to find every match in the text. Results are capped at 1,000 matches.
Will my Python or PHP regex work here?
Patterns run on the browser's JavaScript engine, so syntax can differ. A Python named group (?P<name>…) must be rewritten as (?<name>…), and PHP-style slashes around the pattern are treated as literal characters to match.
Can I replace the matches with other text?
This tool only reports matches. To substitute text with a tested pattern, use Find and replace text and set the search method to JavaScript regular expression. If a pattern runs too long, choose Cancel while it is processing.