Re: Re: \k Escape - Regex Perl

"Gurpreet Sachdeva" <[email protected]> 17 Aug 2004 04:30:16 -0000
Newsgroups gmane.user-groups.linux.delhi.devel
Message-ID <[email protected]>
On Tue, 17 Aug 2004 Navjot Singh wrote :
>me sure that \K wasn't there till 5.005 or even 5.6?
>if you are running on one of these then probably you need to move on
>to 5.8 or later.

Fotunately I am using perl v5.8.3 but unfortunately its not working... :(

>btw, what's \K for?

:o) \K is the escape sequence which fools the Regex Engine to start with a desired position from which you want to match the Regex Sequence

For instance :

[Code Snippet]
  $foo="Gurpreet"
  $foo=~m/(.\K.)/; 
  print $1;
[/Code Snippet]
  will give me "u" rather than "Gu"

Please do check:
http://www.cpan.org/modules/by-module/Regexp/Regexp-Keep-0.01.readme

Regards,
GSS