J
Jason C
Before putting this into production, can you guys confirm if the logic hereis correct?
my $lt = chr(1);
my $gt = chr(2);
$text =~ s/<(\/{0,1})(div|span|table|tr|td|font|img)(.*?)>/$lt$1$2$3$gt/gsi;
What I'm not sure about is if (div|span...) will work correctly, or if it'sgoing to read "di, followed by either v or s, followed by pa", and so on.
(FWIW, the next step in the process is to remove all other HTML code, so that only these tags are allowed. Then, I go back and change $lt and $gt backto < and >. This concept works well, so my only real question is whether the regex will work as expected.)
my $lt = chr(1);
my $gt = chr(2);
$text =~ s/<(\/{0,1})(div|span|table|tr|td|font|img)(.*?)>/$lt$1$2$3$gt/gsi;
What I'm not sure about is if (div|span...) will work correctly, or if it'sgoing to read "di, followed by either v or s, followed by pa", and so on.
(FWIW, the next step in the process is to remove all other HTML code, so that only these tags are allowed. Then, I go back and change $lt and $gt backto < and >. This concept works well, so my only real question is whether the regex will work as expected.)