On Thu, 29 Dec 2005, Bob Showalter wrote: > Jeff Pang wrote: > > Hi,bob, > > > > You said: > > > > 3. It will probably be faster to use a single regex of the format: > > > > /pata|patb|patc|patd/ > > > > > > In fact maybe you are wrong on this. > > Darn. First time this year :-) > > > Based on my test case,the RE written as below: > > > > /pata/ || /patb/ || /patc/ || /patd/ > > > > is much faster than yours. > > OK. Perhaps its due to backtracking. Go with what works! Several Perl books, including _Mastering Regular Expressions_ and, if I remember correctly, _Learning Perl_, use variants of this example. In essence, yes, if you want to match one of several constant strings like this, the match will happen faster with a series of static regexes than it would wwith one compound regex with alternation.
-- Chris Devers DO NOT LEAVE IT IS NOT REAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>