in reply to Re^2: Search patern within pattern in a single substitute command
in thread Search patern within pattern in a single substitute command

What does the \K mean?

from Perldoc perlre: "Character Classes and other Special Escapes"

\K Keep the stuff left of the \K, don't include it in $&

It says that the bit of the regex preceding it is only used to locate the part of the string to be replaced, but isn't a part of the substitution. It just saves the need for an extra capture.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Search patern within pattern in a single substitute command
by shobhit (Sexton) on Mar 04, 2011 at 05:40 UTC
    Makes sense. Thanks a lot for your help.