Regular Expression help

Edward Elliott nobody at 127.0.0.1
Thu Apr 27 18:19:56 EDT 2006


johnzenger at gmail.com wrote:
> If you are parsing HTML, it may make more sense to use a package
> designed especially for that purpose, like Beautiful Soup.

I don't know Beautiful Soup, but one advantage regexes have over some
parsers is handling malformed html.  Omitted closing tags can wreak havoc. 
Regexes can also help if you only want elements preceded/followed by a
certain sibling or cousin in the parse tree.  It all depends on what you're
trying to accomplish.  In general though, yes parsers are better suited to
extracting from markup.




More information about the Python-list mailing list