http://qs1969.pair.com?node_id=316018


in reply to Naughty Regular Expressions and mod_perl

Regex is still a bit of an alien beast to me so forgive me if this sounds really simpleton. According to Camel, Perl uses a similar mechanism to produce $1, $2, and so on, so you also pay a price for each pattern that contains capturing parantheses.

Is the performance punishment the same as $&, $`, $'. Where once I use a capturing parantheses to produce a $1, $2, etc. Then that performance penalty now exists for all regex's regardless of whether or not I use capturing parantheses because I used capturing parantheses elswhere?

edit:You know what? My poor addled brain finally put three and two together after I read each word on that page in Camel over and realized that they make whole paragraphs. The performance hit occurs for capturing paranthesis, but it's limited in scope to the specific regex in question. It doesn't incur the same global penalty as $&, $`, $' does. I think I'll go sleep on the floor now.

----
Is it fair to stick a link to my site here?

Thanks for you patience.