Regex Tester
Test a regular expression against real text, with capture groups, replacement and a safety net.
Runs in your browser — nothing you type is sent anywhere
About the Regex Tester
Writing a regular expression is mostly a loop: try a pattern, look at what it matched, adjust. Doing that against real text rather than in your head is the entire point of a tester, and seeing the capture groups separately is usually what tells you which part is wrong.
Every match is listed with its position and the contents of each numbered and named group, including the groups that did not participate — which are shown as such rather than silently omitted. That distinction matters when you are debugging an alternation, because a group being empty and a group not matching at all mean different things.
The replacement box uses the same references as JavaScript's own replace: dollar-one for a numbered group, dollar-angle-brackets for a named one, and dollar-ampersand for the whole match. What you see here is therefore exactly what your code will produce, rather than an approximation.
The unusual part is the safety net. A pattern with one repetition nested inside another, such as an inner plus wrapped in an outer plus, can take exponential time on certain inputs — the tab freezes, with no error and no way to stop it. This tester runs the match in a background thread and stops it after two seconds, then explains what happened. Patterns with that shape are flagged before you even run them.
Everything happens on your device, so the text you are testing against never leaves it.
How to use the Regex Tester
Write your pattern
Type it between the slashes, or start from one of the examples for email addresses, URLs, dates and more.
Set the flags
Global finds every match, ignore-case is self-explanatory, and multiline changes what the anchors mean. Each button explains itself on hover.
Paste your test text
Matches appear immediately, each with its position and the contents of every capture group.
Try a replacement
Turn on the replacement box to see the rewritten text, using the same group references your code would use.
Frequently asked questions
Why did my regex freeze other testers but not this one?
What is catastrophic backtracking?
Which flavour of regular expression is this?
Why is one of my capture groups showing as no match?
Does the replacement work the same as in my code?
Is my test text sent anywhere?
You may also need
JSON Formatter
Format, validate and minify JSON — with the exact line and column of any error.
Text Sorter
Sort lines alphabetically or by number, reverse them, or shuffle them at random.
Remove Duplicate Lines
Strip repeated lines from a list while keeping the original order intact.
Hash Generator
Produce a SHA-256, SHA-384, SHA-512 or SHA-1 digest, and check it against a known value.