L
Lord0
Hi there,
I thought the following regex would be trivial to implement - ha ha.
Basically I have a string which contains html tags. Some of the tags I
want to keep (<em></em>, <p></p> etc), some I want to remove. I got
*this* far but obviously it doesn't work....
#! /usr/bin/perl -w
use strict;
my $string = "<p><table>This is a test</table></p>";
# would expect "<p>This is a test</p>"
# Tags to keep #
$string =~ s/<\/?(?!(p|ul|li|strong|em)).*?>//g;
print $string."\n";
I know how much you lot like regex's ;-) so any help.....
Cheers
Lord0
I thought the following regex would be trivial to implement - ha ha.
Basically I have a string which contains html tags. Some of the tags I
want to keep (<em></em>, <p></p> etc), some I want to remove. I got
*this* far but obviously it doesn't work....
#! /usr/bin/perl -w
use strict;
my $string = "<p><table>This is a test</table></p>";
# would expect "<p>This is a test</p>"
# Tags to keep #
$string =~ s/<\/?(?!(p|ul|li|strong|em)).*?>//g;
print $string."\n";
I know how much you lot like regex's ;-) so any help.....
Cheers
Lord0