Tuesday 7 November 2023

Show HN: Regexdiff – a novel way to analyze regular expressions https://bit.ly/49pw6x2

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://bit.ly/3QPELSl November 7, 2023 at 02:08AM

No comments:

Post a Comment