Replaced regular expressions with BeautifulSoup.