in reply to (Guildenstern) RE: RE: Shot myself in the foot with a pos
in thread Shot myself in the foot with a pos

Perl only cares about pos() for matches with the /g modifier. Drop the /g, and all attempts at matching start from the beginning of the string.

As for the code I provided, well good luck deciphering it. The algorithm I used is pretty complex. The key idea though is for each packet to maintain a hash whose keys are the substrings we are still interested in, and whose values are the set of positions in that packet where the pattern starts. :-)

I don't tend to write production code like that....

  • Comment on RE (3): Shot myself in the foot with a pos