regexdiff is a tool that analyzes regular expressions. you can use it to figure out what a regex does, or why one that you wrote isn't working right. the way it works is simple: you put in a regex and a string, and it tells you the closest string to the one you gave that matches the instruction.

for example, if you've written a URL regex https://\w+\.\w+ and it isn't matching the right strings, you could put http://google.com in and regexdiff will tell you that it needs an s to match -- sounds like you forgot a ?! it will also tell you that https://www.example.com doesn't match because it has too many dotted sections.

this tool works with the mathematical kind of regexes. it does not care about capturing groups or laziness qualifiers.

backreferences and recursion are not supported, but lookahead and lookbehind (both positive and negative) are. note that if the "anchored" flag is enabled, your regex will not be able to match anything if you put a lookahead at the end of it. instead of followed by foo: (?=foo), you can just write followed by foo: foo.


if the tool complains that your regex "cannot match any strings", it means that its structure is contradictory in such a way that there is no string that matches it. one way this might happen is misusing lookaround, like by doing (?=a)b.

if the "anchored" flag is enabled, it always creates an impossible expression if you have a lookahead at the end of the expression or a lookbehind at its beginning, because you cannot simultaneously be at the end of the match and still have characters remaining.