Use HtmlTidy to parse webpages instead of regular expressions.