in reply to Re: Improve processing time for string substitutions
in thread Improve processing time for string substitutions

Is there a reason for the non-capturing parens in "$re = qr/(?:$re)/;"?

What good does the /e switch do in the regex "s/($re)/$entitylist{ $1 }/ge;"?

Anno

Replies are listed 'Best First'.
Re^3: Improve processing time for string substitutions
by ikegami (Patriarch) on Apr 16, 2007 at 15:56 UTC
    No (qr// already adds non-capturing parens) and none (interpolation is done after each match).
Re^3: Improve processing time for string substitutions
by Corion (Patriarch) on Apr 16, 2007 at 15:56 UTC

    The /e switch is an error by me - it is a leftover from when I thought about doing the hex-conversion manually with a sprintf call in the right hand side..

    I always build my regular expressions with noncapturing parentheses when I pal on latter assembling them - this prevents embarassing bug hunts later when I change how the target RE is built, possibly by repeating one ("atomic") building block - leaving out the parentheses causes hard-to-track misbehaviour with input on the seam of the two blocks.

    .
      I always build my regular expressions with noncapturing parentheses when I pal on latter assembling them - this ...

      Same here, but I've always thought of qr// as an alternative way to add those parens (which it does). You are, in effect, adding two pairs.

      Anno