title: Python one-liner to robustly extract result of a regular expression search
body: <p>Is it possible to express the following with the help of a simpler one-line expression?</p>
  
  <pre><code>def search(x):
     # Return a keyword or None if not found.
     ret = re.search('^(foo|bar|baz)', x)
     return ret.group() if ret else None
  
  texts = ['fool', 'minibar', 'bark', 'honk']
  map(search, texts)
  </code></pre>
  
  <p>This returns: <code>['foo', None, 'bar', None]</code></p>
  
  <p>Searching a text in a string and retrieving the matching token is a pretty common task and I wondered whether there is a more direct way to achieve the same. </p>
  
  <p>I would like to write this using a one-liner, without having to declare a separate function. Do <code>re</code> or other modules offer a more direct way to find and retrieve matches, basically a short-cut for my above function? For instance, does something like the following exist?</p>
  
  <pre><code>texts = ['fool', 'minibar', 'honk']
  map(lambda x: re.search_and_retrieve, texts)
  </code></pre>
  
  <p>Or is there a neat, readable way to test and safely retrieve the output from <code>re.search()</code> in one line?</p>