How can I handle several regexp cases neatly in python
<p>So I get some input in python that I need to parse using regexps.</p>

<p>At the moment I'm using something like this:</p>

<pre><code>matchOK = re.compile(r'^OK\s+(\w+)\s+(\w+)$')
matchFailed = re.compile(r'^FAILED\s(\w+)$')
#.... a bunch more regexps

for l in big_input:
  match = matchOK.search(l)
  if match:
     #do something with match
     continue
  match = matchFailed.search(l)
  if match:
     #do something with match
     continue
  #.... a bunch more of these 
  # Then some error handling if nothing matches
</code></pre>

<p>Now usually I love python because its nice and succinct. But this feels verbose. I'd expect to be able to do something like this:</p>

<pre><code>for l in big_input:      
  if match = matchOK.search(l):
     #do something with match     
  elif match = matchFailed.search(l):
     #do something with match 
  #.... a bunch more of these
  else
    # error handling
</code></pre>

<p>Am I missing something, or is the first form as neat as I'm going to get?</p>
