[Mimedefang] Code fragment works only sometimes
Kevin A. McGrail
kmcgrail at peregrinehw.com
Tue Jul 15 13:15:01 EDT 2003
Michael,
I must admit, I am confused why would you need to run a regexp variable
through quotemeta? Has $line already been run through quotemeta and you
won't get a match otherwise? Some sort of safety test I'm not familiar
with?
KAM
----- Original Message -----
From: "Michael Sims" <michaels at crye-leike.com>
To: <mimedefang at lists.roaringpenguin.com>
Sent: Tuesday, July 15, 2003 12:08 AM
Subject: Re: [Mimedefang] Code fragment works only sometimes
> Quoting alan premselaar <alien at 12inch.com>:
>
> > if ($line =~ /$blk/i) {
> > #do stuff here
> > }
>
> He might want to run $blk through quotemeta in case it contains regex
> metacharacters. Probably won't come up, but you never know...
>
> my $quotedBlk = quotemeta $blk;
> if ($line =~ /$quotedBlk/i) {
> #do stuff
> }
>
> > there may even be an lcase() function
>
> It's "lc":
>
> if (rindex(lc $line, lc $blk) != -1)
>
> ___________________________________________
> Michael Sims
> Project Analyst - Information Technology
> Crye-Leike Realtors
> Office: (901)758-5648 Pager: (901)769-3722
> ___________________________________________
> _______________________________________________
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
>
More information about the MIMEDefang
mailing list