Regex Tester
Write a regular expression and see every match highlighted in your test text, with capture groups and a replace preview.
Test text
Matches
Matches are highlighted here as you type.
JavaScript (ECMAScript) regular expressions. Your text stays in this browser tab.
How to use the Regex Tester
- Enter a pattern, without the surrounding slashes.
- Toggle flags such as g (global), i (ignore case) and m (multiline).
- Paste test text. Matches highlight as you type.
- Optionally enter a replacement to preview the result, using $1 or $<name> for groups.
Example
Input
Pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
Text: Shipped 2024-03-18, delivered 2024-03-21.Result
2 matches, with year, month and day groupsWhat it does
- Live highlighting
- Every match is highlighted in the text, and listed with its position and groups.
- Safe from runaway patterns
- Patterns run in a background worker with a time limit, so a catastrophic backtracking pattern cannot freeze the page.
- Replace preview
- See the result of a replacement with $1, $& and named group references.
Frequently asked questions
Which regex flavour is this?
JavaScript (ECMAScript), as implemented by your browser. Most syntax is shared with PCRE, Python and Java, but some features such as possessive quantifiers and inline flags are not available.
Why does my pattern time out?
Nested quantifiers such as (a+)+ can take exponential time on some inputs. The tester stops after one second. Rewrite the pattern to avoid ambiguous repetition.
Is my data sent to a server?
No. The conversion runs in your browser, and nothing you paste is uploaded, logged or stored.