devShakib

Loading devShakib…

Regex Sandbox

Test, replace, and learn regex live — match list, groups, substitutions, a 15-pattern library and a token-by-token explainer. On-device.

Most regular expressions fail on greediness or on group numbering. .* consumes as much as it can and backtracks only when forced, so a pattern written for one tag swallows the line; the lazy .*? is usually what was meant. Group numbers count opening parentheses left to right, so wrapping a section later silently shifts every index.

A token-by-token explainer is the part that turns testing into learning. And a pattern worth testing before it ships is one with nested quantifiers — some shapes make the engine explore exponentially many paths on near-matching input, which is how a regex that runs instantly on your examples hangs a server later.