4 ms·
With today's widely available DOM manipulation tools (jsdom, phantom, zombie) and proper HTML parsers in javascript there is absolutely no reason to use RegExps
by ricardobeat 14y ago
With today's widely available DOM manipulation tools (jsdom, phantom, zombie) and proper HTML parsers in javascript there is absolutely no reason to use RegExps.
- chimeracoder 14y ago> (jsdom, phantom, zombie) and proper HTML parsers in javascript Well, for starters, if you're not using Javascript. All four tools you mentioned are Javascript-based.
- klibertp 14y agoThere is an XPath implementation for everything under the sun now - I saw and used one even in Erlang - and such an implementations beats regexes in readability and loc 9 times out of 10. The only real reason to use regexes is when dealing with html so broken that parts of it are inaccessible through parser.
- jgraham 14y agoOn the other hand, the world would really benefit from someone updating the libxml2 HTML parser to match the HTML(5) spec, since it has popular bindings for many other languages (e.g. lxml in python). The current implementation is broken in lots of (not so) edge cases. This can be a problem when there is the choice of being fast and wrong (using libxml2) or being slow and correct (using html5lib or one of the other high level implementations of the standardised algorithm).