3 ms·
There are plenty of good, real html parsers, so there's no need to try regex. Xpath is nice for scraping HTML, though it always turns out the stuff you need is
by elchief 14y ago
There are plenty of good, real html parsers, so there's no need to try regex.
Xpath is nice for scraping HTML, though it always turns out the stuff you need is in the middle of a bunch of other text.
- philip1209 14y agoI would imagine that valid HTML could be parsed as XML, e.g. with the Python ElementTree XML API
- aardvark179 14y agoThat would be true for XHTML but not for HTML as tags like paragraph do not always require a end tag, which would break XML parsing.
- philip1209 14y agoI was under the impression that HTML4 introduced XML requirements, thus requiring the </p> tag.