Anyhow, I came up with this:
#!/usr/bin/perl
open (FP,"foo.html");
@lines=<FP>;
close (FP);
open (OUT,">bar.html");
foreach $i (@lines) {
$i=~s/<((?:(?!<).)*)>/"<".lc($1).">"/eg;
print OUT "$i";
}
close(OUT);
The snag is that it lowers the case of *everything* in a tag eg alt text. Can anyone come up with a better solution?
Just to make sure I understand, how should it handle a tag like this:
<IMG SRC=MyFile.gif Alt="La De Da" bOrDeR=3>
I assume you want it to produce
<img src=MyFile.gif alt="La De Da" border=3>
The hard part comes in identifying what's a value and what's not, especially when the use of quotes around URLs etc. is optional.
I think I'd have to suggest using the HTML module to parse the HTML, but that takes all the 'fun' out of finding the solution.