Re:You Cannot Parse HTML with Regular Expressions
by jmount on Sunday April 18, 2010 @11:24AM
(#1274940)
"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." Jamie Zawinski 1997.
[ Parent
| on HN ]
Re:You Cannot Parse HTML with Regular Expressions
by 83457 on Sunday April 18, 2010 @11:44AM
(#1274968)
No one should ever use regular expressions because there is a cute quote that says not too.
Re:You Cannot Parse HTML with Regular Expressions
by jmount on Monday April 19, 2010 @01:34AM
(#1276164)
The problem is that regular expressions (in addition not being powerful enough to properly handle HTML) are a bit of a maintenance headache. They look like line noise. Most regular expressions don't change properly with local (did you use \w, [a-zA-Z] or \p{Alpha} and which of these did you really mean). And you can't always be sure the regexp is implemented efficiently (by compiling a finite automata instead of search, see http://swtch.com/~rsc/regexp/regexp1.html ). Often a parser generator (of which a lexer is often the first step, which is as powerful as regular expressions) is a much better solution.
Re:You Cannot Parse HTML with Regular Expressions
by fmota on Sunday April 18, 2010 @12:23PM
(#1275028)
Also, because regular expressions are not the right tool for the job sometimes.
("No one should ever use regular expressions" is hyperbolic and wrong.)
Re:You Cannot Parse HTML with Regular Expressions
by james2vegas on Sunday April 18, 2010 @01:07PM
(#1275099)
"Some people, when confronted with a problem, think 'I know, I'll quote Jamie Zawinski.' Now they have two problems."