Your skill will accomplish
what the force of many cannot
Re^2: Matching against list of patternsby Random_Walk (Prior)
|on Sep 16, 2004 at 14:26 UTC||Need Help??|
If I understand the regexp engine caching the compiled version of a regex if it is not going to change then I think this should be a reasonably efficient approach. Am I on the right tracks ? and is the /o unrequired as I have already interpolated the variable when the regex is first called ?
Update with speed test
I have now run a comparative test over 300^H^H^H, sorry 416 lines of log, with my 672 pattern matches. First using the eval of a string containing all the regexen and returning match index numbers as above. Second is my old naive code holding an array with the regexen and doing a foreach through it against each line. I did not use the /o for the reasons given above it works fine without it
I think the numbers speak for themselves