Hi, whats the right way to precompile a regular expression that gets used multiple 
times without changing.  

I don't think I can use /o, because the specific line of code which performs the 
pattern match is used to check various patterns against various values at various 
times.  None the less, the patterns themselves don't change, once established, and it 
seems I should be able to save a precompiled regular expression in a variable and use 
it when it's time to match the corresponding pattern.

The code as it stands looks like this:

   if( defined($addr) and $addr =~ /$self->{_rule}/i ) {
       $retval = $self->{_confidence};
       }

which is an object method used with multiple object instances each having its own 
value for $self->{_rule}, which is why I can't use /o.

Any help very much appreciated, and yes I am now rereading the documentation.



__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

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

Reply via email to