— 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
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 === node2.transition.range etc...
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...
— The resulting DFA for each one would then be equivalent and as simple as a graph diff
— With global flag,
/hello/ looks like this:
— 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!
/hello/g matches to
— Whereas without, it only gets that first one
— Heh, well I am trying to balls-up my graph theory library XD
— I talked to senior engineer at my job and he was like "who needs that and are they on drugs???"