How to Use This Tool
A regular expression is easy to write and hard to be sure about. The gap between "it matched my three test strings" and "it is correct" is where most regex bugs live, and the only reliable way to close it is to watch the matches highlight against real data as you type.
Writing and testing
Type the pattern in the top field — without the surrounding slashes, which are shown for you. Flags go in the box after, or use the checkboxes. The test string below highlights every match live, and the panel underneath lists each match with its position and every capture group broken out separately.
Capture groups are the part worth paying attention to. A pattern that matches is only half the job; if you are extracting data you need the groups to land where you expect. The list shows group 1, group 2 and any named groups by name, per match, so a mistake is visible immediately rather than three functions later.
? after a quantifier makes it lazy. This one character is the difference
between four tags and one enormous match, and it is the second most common regex mistake.The backtracking guard
Some patterns are pathological. Nested quantifiers such as (a+)+b can make the engine try an
exponential number of paths on input that nearly matches, freezing the tab for minutes. This is not a
theoretical concern — it is a real denial-of-service class called ReDoS, and it has taken down production
services.
Every evaluation here runs under a time budget. If the pattern exceeds it, execution stops, you get an explanation naming the likely culprit, and your browser stays responsive. That is a feature most online regex testers do not have, which is why some of them can be crashed by a five-character pattern.
Replace preview
The bottom field previews a replacement across the whole test string. Use $1,
$2 for capture groups and $& for the whole match. Getting a replacement right
in a preview takes seconds; getting it wrong in a script that has already rewritten four hundred files takes
considerably longer.
A note about flavour
This uses JavaScript's regex engine, which is what runs in browsers and Node. Most syntax is shared
across languages, but there are real differences: JavaScript has no lookbehind in older Safari, no atomic
groups, and no \A or \z anchors. A pattern verified here will work in
JavaScript; if you are targeting Python, PCRE or Go, test it there before trusting it.
