3 ms·
In my experience, an XPath (or CSS selector) to get relevant information is both easier to construct and easier to understand than a regular expression, and the
by simonster 14y ago
In my experience, an XPath (or CSS selector) to get relevant information is both easier to construct and easier to understand than a regular expression, and the resulting code is more likely to continue to work as the website changes. I don't see why you would subject yourself to using regular expressions unless your environment doesn't have an HTML parser.
- fuzzix 14y agoIn this particular instance, for reasons of a self-imposed contraint to favour ease of deployment and use by the target audience, I have no parser. Using xpath (or just about anything else) would be smashing. The likelihood of the markup changing to the point where the code breaks is unlikely, the target pages are open source mirrors exposed over HTTP. It even winds up being nicer code than the FTP handler.