in reply to Re: Converting HTML tags into uppercase using Perl
in thread Converting HTML tags into uppercase using Perl
See, this is why you should never try to parse arbitrary HTML with regular expressions. Your regex doesn't handle a number of very common occurances. The first thing that springs to mind is tags with attributes - the tag name will be upper-cased, but the attribute names will be left untouched. The original poster was unclear as to what sohuld be done in those circumstances.
Also can you be sure that every < character in the document starts a tag? What if it was in a CDATA section?
All in all, I think it's far better to use an HTML parser. They are there to be used, so why not use them?
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Converting HTML tags into uppercase using Perl
by inman (Curate) on Nov 29, 2005 at 11:59 UTC |