Is 1 large Regex faster than 3 smaller ones?

erikcw erikwickstrom at gmail.com
Sun Jun 3 20:52:07 CEST 2007


Hi,

I need to match 3 small strings in a small text file (about 200 words
of text).

Would it be faster to write 1 compiled regex that matches all 3
substrings in one go, or to use 3 separate regular expressions to do
the same job?

Thanks!
Erik




More information about the Python-list mailing list