Message from JavaScript discussions

August 2017

— 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!

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

— 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???"

— Agreed

— 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

Message permanent page

— 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

— The hard part is writing the parser to turn the regex into DFA... but that itself can possibly be made out of a DFA too

Message permanent page