> -----Original Message-----
> From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 12:29 PM
> To: '[EMAIL PROTECTED]'
> Subject: Removing HTML Tags
> 
> 
> Gidday all,
>  
> When using our CMS (Interwoven Teamsite) I want to remove 
> from any textarea any html tags that I don't want content 
> contributors to use. On in particular is the font tag. Can 
> one use a regex to remove these?
>  
> I guess Im looking for a regex to remove anything between the 
> font tags e.g <font>and </font>. Of course their could be 
> anynumber of attributes in the openning font tag.
>  
> Any help appreciated
> Thanking you in anticipation  
>  
> Colin Johnstone 
> 
>  
> 

use strict;
use warnings;

my @remove_tags = qw(i b font);

my $html = 'Some text. <i>italics</i> <b>bold</b> <font  class="myclass"
size="2">Hi There</font> <font>ABC
</font> <h1>Hi</h1>';

foreach my $tag (@remove_tags)
{
        $html =~ s!<$tag.*?>(.*?)</$tag>!$1!gs;
}

print $html;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to