in reply to Re^3: matching a regular expression
in thread matching a regular expression

I know this is pedantic, but index() doesn't stop looking after it fails to find the target at position 0 of the string. The regex does. The regex fails very fast. Add a \Q...\E and an /i modifier, and you have a perfectly reasonable solution. And, as my solution above showed, you can get more bang for your buck.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^5: matching a regular expression
by blazar (Canon) on May 18, 2006 at 16:22 UTC

    Gawd, I can trust you on the reputation of your expertise, but however pedantic you like to be... is that relevant in any way?!?