title: BeautifulSoup SoupStrainer strain html and pdf links
body: <p>What do I need to pass as a regex pattern to grab both html and pdfs from an HTML webpage? So far, what I have is below. I assumed that I needed to use an OR statement, but that didn't really work as expected.</p>
  
  <pre><code>status, response = http.request("http://www.example.com")
  htmlandpdfonly=SoupStrainer('a', href=re.compile('html|pdf'))
  for link in BeautifulSoup(response, parseOnlyThese = htmlandpdfonly):
      if(link.has_key('href')):
          print link['href']
  </code></pre>