News for hackers. Stuff that matters.
Re:Can regular expressions parse HTML or not? by blaabjerg on Thursday February 21, 2013 @11:01AM (#5258118)
Would that really count as parsing? Honest question.
Re:Can regular expressions parse HTML or not? by RyanZAG on Thursday February 21, 2013 @11:23AM (#5258303)
I'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.
Re:Can regular expressions parse HTML or not? by nmcfarl on Thursday February 21, 2013 @11:40AM (#5258403)
Good 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.