3 ms·
I suppose that depends entirely on how the parser was implemented. You could write a scanner that doesn't use regexes. It could just read in characters one at
by statictype 17y ago
I suppose that depends entirely on how the parser was implemented.
You could write a scanner that doesn't use regexes.
It could just read in characters one at a time and hard-code the logic for matching tokens.
On the other hand, I wouldn't be surprised if many of the standard html parsing libraries use regex libraries internally to match tokens.
If you used a scanner generator like lex, you would specify your scanner using regexes and lex would generate code that expands those regexes into an automata. I guess that also counts as using regexes, only they're compiled down at compile-time instead of at runtime.