On Thu, 2003-01-23 at 13:12, Toby Stuart wrote:
> small modification below.
> 
> > -----Original Message-----
> > From: Toby Stuart [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 23, 2003 12:56 PM
> > To: 'Johnstone, Colin'
> > Cc: '[EMAIL PROTECTED]'
> > Subject: RE: Removing HTML Tags
> > 
> > 
> > 
> > 
> > > -----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;
>       
>       # Actually this is probably a bit better :)
>       $html =~ s!<$tag.*?>(.*?)</$tag>!$1!gsim;




does it make sense to use the 's' and 'm' modifiers together... doesn't
's' mean treat the text as a "single line" and 'm' mean "treat it as
multiple lines"! ?






> 
> > }
> > 
> > print $html;
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 


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

Reply via email to