Re: why a.pl is faster than b.pl



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! .