title: Extract href from <a> tag with class uses Regex
body: <p>I need to read many pages from a website and extract all links with class "active" using a regex.
  This tags can have the class attr BEFORE or AFTER the HREF value.</p>
  
  <p>My code is:</p>
  
  <pre><code>    try:
          p = requests.get(url, timeout=4.0)
      except:
          p = None
      if p and p.content and p.status_code &lt; 400:
          canonical_url = re.search('&lt;a class="active" href="(.*)?"', p.content, flags=re.MULTILINE|re.IGNORECASE|re.DOTALL|re.UNICODE)
  </code></pre>
  
  <p>but with this regex I can catch only links with class active BEFORE the HREF and not AFTER.
  Thanks.</p>