Regex Tester
Try a pattern on text and show matches and groups in a separate worker you can stop.
Use $1, $2 for groups, $<name> for named groups, and $& for the whole match.
The search runs in a separate worker. A search still running after two seconds is stopped, so a slow pattern cannot freeze the page.
Your result
Type a pattern and some text. Matches are highlighted here.
How to use it
- Type the pattern without the / slashes, or press Try a sample.
- Pick flags and paste the text to search.
- Read the matches and groups, and try a replacement if you need one.
Examples
- A phone number(\d{3})-(\d{4}) on 555-1234 one match, groups 555 and 1234
- Arabic letters\p{L}+ with the u flag every Arabic or English word
- Replace($1) $2 (555) 1234
Tool details and privacy
Type a pattern and some text to see matches highlighted in the text itself, plus a table of every match with its position and groups. Add a replacement to see the text after replacing.
Seeing exactly what a pattern matches — and what it misses — is the fastest way to fix it.
Options
- Flags: g all matches, i ignore case, m per line, s dot matches new lines, u Unicode, y sticky.
- In the replacement: $1 and $2 for groups, $<name> for named groups, and $& for the whole match.
- The first 1000 matches are found; the table lists the first 200.
Limits
- The search runs in a separate worker and is stopped if it runs for more than two seconds, so the page never freezes.
- Patterns up to 1000 characters and text up to 100,000 characters.
- An empty match shows as a thin marker in the text.
Privacy
What you type stays in your browser. Nothing is uploaded or saved on the server.
Questions
Why was the search stopped?
Some patterns such as (a+)+$ backtrack a lot; the search stops after two seconds. Make the pattern more specific.
Which regex flavour is used?
JavaScript, as in your browser.
Why turn on u for Arabic?
So \p{L} works and emoji count as one character.
Is the text uploaded?
No.