in reply to Surprisingly poor regex performance

Well, are the two identical? From my reading, I don't think they are. The rewritten version finds "foo", then looks forward and backward to the first newline in both directions. The original version is looking for the beginning of a line after $pat ... ? That doesn't look right ...

Update: It helps to have more than one cup of coffee on Monday mornings ... *sighs*

/me really hates Mondays ...

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

  • Comment on Re: Surprisingly poor regex performance