Why you should not parse (X)HTML with a Regexp
stackoverflow.com
stackoverflow.com
"I think the flaw here is that HTML is a Chomsky Type 2 grammar (context free grammar) and RegEx is a Chomsky Type 3 grammar (regular expression). Since a Type 2 grammar is fundamentally more complex than a Type 3 grammar - you can't possibly hope to make this work. But many will try, some will claim success and others will find the fault and totally mess you up."
More seriously, when SO was newer, I remember the feeling that these things came in waves. For a few months, there was someone who responded to nearly every offending Ruby question (or answer) by pointing out that exceptions shouldn't be used for flow control. See these two by another poster for more on HTML and regexes[1][2].
[1] http://stackoverflow.com/questions/701166/can-you-provide-so...
[2] http://stackoverflow.com/questions/773340/can-you-provide-an...