I've recently been learning about compilers, more specifically Ocaml ones, and I was wondering how does the compiler actually determine which regex a string matches. Does it build a DFA for each regex defined by the lexer and then test each string on each DFA until it finds a match or is there some other algorithm/intuition.
Couldn't find a clear answer online