How to test a regular expression
- Type your pattern and tick the flags you need.
- Paste the text to search.
- Read the matches, groups and explanation.
About this tool
Type a pattern and some text and see every match highlighted at once. A table lists each match with its position and capture groups, including named groups. Preview a replacement, and read a line-by-line explanation of what the pattern means. A pattern that runs forever is stopped after a moment instead of freezing your tab.
Common questions
Which regex flavor is this?
JavaScript, the same engine your browser uses. Patterns for other languages may differ in small ways.
What happens with a pattern that never finishes?
Patterns with nested repeats, like (a+)+, can take a very long time on some text. The test runs in the background and is stopped after 1.5 seconds with a message.
How do I use groups in a replacement?
Write $1, $2 for numbered groups, $<name> for named groups and $& for the whole match.
Is it free to use?
Yes. There's no sign-up, and you can use it as often as you like.
Is my text uploaded anywhere?
No. This tool runs inside your browser, so what you enter stays on your device.
Do I need to install anything?
No. It works in your browser on a computer or a phone.