python regex in html code example
Example: python regex in html
>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML")
>>> print soup.prettify()
<html>
<body>
<p>
Some
<b>
bad
<i>
HTML
import re
print(soup.find_all(re.compile("(p|div)")))