title: Regex: AttributeError: 'NoneType' object has no attribute 'groups'
body: <p>I have a string which I want to extract a subset of. This is part of a larger Python script.</p>
  
  <p>This is the string:</p>
  
  <pre><code>import re
  
  htmlString = '&lt;/dd&gt;&lt;dt&gt; Fine, thank you.&amp;#160;&lt;/dt&gt;&lt;dd&gt; Molt bé, gràcies. (&lt;i&gt;mohl behh, GRAH-syuhs&lt;/i&gt;)'
  </code></pre>
  
  <p>Which I want to pull-out "<em>Molt bé, gràcies. mohl behh, GRAH-syuhs</em>". And for that I use regular expression using <code>re.search</code>:</p>
  
  <pre><code>SearchStr = '(\&lt;\/dd\&gt;\&lt;dt\&gt;)+ ([\w+\,\.\s]+)([\&amp;\#\d\;]+)(\&lt;\/dt\&gt;\&lt;dd\&gt;)+ ([\w\,\s\w\s\w\?\!\.]+) (\(\&lt;i\&gt;)([\w\s\,\-]+)(\&lt;\/i\&gt;\))'
  
  Result = re.search(SearchStr, htmlString)
  
  print Result.groups()
  AttributeError: 'NoneType' object has no attribute 'groups'
  </code></pre>
  
  <p>Since <code>Result.groups()</code> doesn't work, neither do the extractions I want to make (i.e. <code>Result.group(5)</code> and <code>Result.group(7)</code>).
  But I don't understand why I get this error? The regular expression works in TextWrangler, why not in Python? Im a beginner in Python. </p>