problems with case insensitive tr/// regexp
From: Dan Anderson (dan_at_mathjunkies.com)
Date: 11/28/03
- Next message: Daniel Staal: "Re: problems with case insensitive tr/// regexp"
- Previous message: Drieux: "Re: command line interface handling asynchronicity"
- Next in thread: Daniel Staal: "Re: problems with case insensitive tr/// regexp"
- Reply: Daniel Staal: "Re: problems with case insensitive tr/// regexp"
- Reply: John W. Krahn: "Re: problems with case insensitive tr/// regexp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: 27 Nov 2003 19:42:34 -0500
I'm trying to create a script to remove all font tags from an
HTML documents. I created a regular expression like this:
,----[ working code
| use strict;
| use warnings;
| my $foo ="<font> wheeeee";
| $foo =~ tr/\<.*font.*\>//d;
| 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.
So I had:
,----[ erronous code
| use strict;
| use warnings;
| my $foo ="<font> wheeeee";
| $foo =~ tr/\<.*font.*\>//di;
| print $foo, "\n";
`-------------------------------
This code produces the error:
,----[ the error
| Bareword found where operator expected at - line 4, near
| "tr/\<.*font.*\>//di" syntax error at - line 4, near
| "tr/\<.*font.*\>//di"
`----------------------------------------------------------
So what am I doing wrong and how do I make a case insensitive
tr/// regexp?
Thanks for your help,
Dan
- Next message: Daniel Staal: "Re: problems with case insensitive tr/// regexp"
- Previous message: Drieux: "Re: command line interface handling asynchronicity"
- Next in thread: Daniel Staal: "Re: problems with case insensitive tr/// regexp"
- Reply: Daniel Staal: "Re: problems with case insensitive tr/// regexp"
- Reply: John W. Krahn: "Re: problems with case insensitive tr/// regexp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|