Dan Anderson wrote:
> 
>         I'm trying to create a script  to remove all font tags from an
> HTML documents.  I created a regular expression like this:

perldoc -q "How do I remove HTML from a string"


> ,----[ working code
> | use strict;
> | use warnings;
> | my $foo ="<font> wheeeee";
> | $foo =~ tr/\<.*font.*\>//d;

tr/// does not use regular expressions, only m// and s/// and split()
use regular expressions.  tr/\<.*font.*\>//d deletes all the characters
'<', '.', '*', 'f', 'o', 'n', 't' and '>' from the $foo variable.


> | print $foo, "\n";
> `-------------------------------
> 
>         But, in order to remove  tags from documents where the writers
> liked to use uppercase (or camel  case) I want to make the search case
> insensitive.  So I added an  i like when I m/\<.*font.*\>/i font tags.

This may work (untested):

$foo =~ s/<\s*font[^>]*>//gi;



John
-- 
use Perl;
program
fulfillment

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

Reply via email to