— 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???"
— Well that's interesting I guess, I just wonder why you'd need this
— The thing is this also won't work on many regexes since modern regular expressions are not actually regular
— All regular expressions can be represented as a DFA, although the DFA can be extremely large
— Some regex with overlapping terminals may cause problems but it's just an extra case