3 ms·
Debuggex looks interesting. I've never seen regex library/tool before which shows the mismatching location in the input string. I wonder how one could do the sa
by rzmmm 4y ago
Debuggex looks interesting. I've never seen regex library/tool before which shows the mismatching location in the input string. I wonder how one could do the same with python/javascript or other programming languages?
- mdaniel 4y agoI'd guess it's building the FSA then running it but instead of yes/no, emitting the last matched character when in a failed state. I believe that's a common(?) trick for parsers, so it's plausible they do it for regexes As for why "standard" libraries don't offer it, I'd guess it's a development-time concession that production usage doesn't require; python specifically does ship batteries included with the tooling required to make such a thing, but appears to shop just shy of cooking the actual FSA >>> re.sre_parse.parse(r'^(([hH]acker)[ ]?([nN]ews|newsletter))$') [(AT, AT_BEGINNING), (SUBPATTERN, (1, 0, 0, [(SUBPATTERN...