4 ms·
Would that really count as parsing? Honest question.
by blaabjerg 14y ago
Would that really count as parsing? Honest question.
- RyanZAG 14y agoI'm using the term 'parsing' because it's the one used by the article. What else would you use regex and html together for? You only have two options: extracting data from html using regex, or modifying html using regex. Modifying using regex is just string replacement. For example, replacing all hrefs in a html document with new links. You'd use the same method as described above, with a similar 75% of all links replaced.
- nmcfarl 14y agoGood question - but it is 90% of what I see people using HTML parsers for grab the content of a single tag from a page. Which is why I often recommend "parsing" HTML with a regex. Particularly on throwaway projects. The overhead of a real parser is a waste. And if the complexity grows - the sucker will need a rewrite anyhow.