It’s worth reiterating that complex patterns do not make the scanner any slower.*
* There’s one exception: If there are any / operators at all in a flex program,
the whole scanner is slightly slower because of the added logic to handle backing up over the input that is matched but not consumed by trailing context. But in practice such scanners are usually still plenty fast. (查看原文)