Message from JavaScript discussions

August 2017

— You would need to fuzz them with ALL possible strings in existence

— 

So instead of doing that... convert to graph, traverse the graph, do very basic comparison on 2 numbers per-node

— Or you can do like my boss, try a function with 2/3 inputs, if it works then it's ok!

— For a range, you check if your range for regex 1 is within or equal to the range of regex 2 for that specific node

Message permanent page

— You can do a "loose" diff and find out if they are capable of deriving SOME of the same strings, too

— If you want to be strict: node1.transition.range[0] === node2.transition.range[0] etc...

— With g flag it is also possible to diff

— If you have two regex, say one is 10 characters and the other is 10 million.... but they can derive the exact same strings, but you can't tell that by comparing the source strings or running them...

Message permanent page

— The resulting DFA for each one would then be equivalent and as simple as a graph diff

— With global flag, /hello/ looks like this:

-->(s1)-h->(s2)-e->(s3)-l->(s4)-l->(s5)-o->((s6))
^___________________ε___________________/

Message permanent page

— Epsilon (an E-move) automatically transitions to a node... with g flag it basically says "keep going after first match", meaning that E-move is followed!

Message permanent page

— So /hello/g matches to hellohellohellohello etc...