Nothing uploaded
Regex tester
Write a regular expression, paste some text and see the matches highlighted, with their capture groups. Try replacements with $1 and named groups.
Without the slashes around it, for example \d{3}-\d{4}
$1 is the first group, $<name> a named group, $& the whole match.
Matches
Each match
What you type stays on this device. Nothing is uploaded.
Did this save you time? DigiTools is free, with no ads and no sign-up. Leave a tip (opens in a new tab) to help keep it that way.
How to test a regular expression
- Type your regular expression, without the slashes, and choose the flags.
- Paste the text to test. Matches are highlighted and listed with their capture groups.
- To replace, turn on Replace matches and type the replacement: $1 is the first group, $<name> a named group.
Questions
Is my text sent anywhere?
No. Matching happens in your browser on this device, so log files, emails and customer data never leave it.
Which regex flavour is this?
JavaScript (ECMAScript), as run by your browser. Most syntax is the same as in Python, Java, PHP and .NET, but a few features differ: JavaScript has no possessive quantifiers or atomic groups, for example.
Why did it stop after one second?
Some patterns, like (a+)+$, can take an extremely long time on certain text, which is called catastrophic backtracking. The tool stops after a second so your browser doesn’t freeze. Make the pattern more specific, for example by avoiding repetition inside repetition.
How do I use groups in the replacement?
$1, $2 and so on insert numbered groups, $<name> a named group (?<name>…), $& the whole match and $$ a dollar sign.