title: Efficiently match many regex in Python?
body: <p>In one of my programs I had to check whether a line matches one of some 20000 regex expressions.</p>
  <p>I tried putting the regex into a long chain of <code>&quot;something1|something2|...something20000&quot;</code>, or making a list of <code>20000</code> regex expressions and running a for-loop over it. I have been using the standard re library. In most cases I have to wait ~20 seconds for the match to finish. I am wondering if there is a faster way, provided that the regexes cannot be simplified or combined easily.</p>