A problem I run into sometimes on my websites is, they fail the W3C HTML Validator on the grounds that I tend to use a lot of &'s in hyperlinks without using &
i.e.
And by the time I think to validate it, there are many pages to go through (imho, it shouldn't complain when an & is used within an href), so I decided to try using a regexp on the content before it gets printed to the browser (this is a CGI website)
Does anybody know of a simple regexp? The one I had to settle with is kinda blech:
Thanks in advance.
-------------
Cuvou.com | The NEW Kirsle.net
i.e.
Code:
<a href="file.cgi?color=blue&font=Arial">
they want it to be:
<a href="file.cgi?color=blue[COLOR=red]&[/color]font=Arial">
And by the time I think to validate it, there are many pages to go through (imho, it shouldn't complain when an & is used within an href), so I decided to try using a regexp on the content before it gets printed to the browser (this is a CGI website)
Does anybody know of a simple regexp? The one I had to settle with is kinda blech:
Code:
$cuvou->{template} =~ s/&#/__amp__number__/ig;
$cuvou->{template} =~ s/</__amp__lt__/ig;
$cuvou->{template} =~ s/>/__amp__gt__/ig;
$cuvou->{template} =~ s/&/__amp__amp__/ig;
$cuvou->{template} =~ s/"/__amp__quot__/ig;
$cuvou->{template} =~ s/'/__amp__apos__/ig;
$cuvou->{template} =~ s/&/&/ig;
$cuvou->{template} =~ s/__amp__number__/&#/ig;
$cuvou->{template} =~ s/__amp__lt__/</ig;
$cuvou->{template} =~ s/__amp__gt__/>/ig;
$cuvou->{template} =~ s/__amp__amp__/&/ig;
$cuvou->{template} =~ s/__amp__quot__/"/ig;
$cuvou->{template} =~ s/__amp__apos__/'/ig;
Thanks in advance.
-------------
Cuvou.com | The NEW Kirsle.net