I am confused about the relation between KMP (Knuth–Morris–Pratt) and Regex (DFA-based) Searching.
My thought is that KMP cannot use regex notations (e.g., (A|B){2}C
), so it can only search for a "single" string (e.g., AC
or BC
, but not AC|BC
). Is this true?
Another question, if the pattern is a single string (ABABAC
), are they essentially using the same?