Show HN: Regexdiff – a novel way to analyze regular expressions regexdiff is a tool that finds the difference (think `diff` or Levenshtein distance) between a string and a regex. That means it shows the steps required (insertions and deletions) to turn a given string into one that matches a given pattern. I'm not the first person to have this idea or to come up with the algorithm (for example, a few existing engines use this to implement approximate matches), but it wasn't available in a convenient form, so I decided to make this little toy. In order to support lookaround, it also includes an algorithm that compiles arbitrary-length lookahead and lookbehind into a DFA. I haven't seen this done anywhere before. While this isn't the most substantial project, I have managed to find a few uses for it since I made it half a year ago, so I thought I'd share it here. https://regexdiff.com/ November 7, 2023 at 04:08AM
0 Comments