convert regex to dfa and use the transition table for lexical analysis