Can someone explain how lookaheads work and give an example of using one
Cheers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
On Fri, 14 Jan 2005 07:11:30 +, Andrew Black
[EMAIL PROTECTED] wrote:
Can someone explain how lookaheads work and give an example of using one
Cheers
I find the full names of these regex constructs to be quite
enlightening: zero-width (positive|negative) look-(ahead|behind)
assertion.
So
I have a string
$X='#SOME_STRING END';
I want to remove the begining '#' and ending 'END' but retain everything
in between.
This way works fine
$X=~s/^#(.*?) END$/$1/; # $X is now SOME_STRING
But this way does not
s/^#(?=.*) END$//; ## $X is still
From: Ramprasad A Padmanabhan [EMAIL PROTECTED]
I have a string
$X='#SOME_STRING END';
I want to remove the begining '#' and ending 'END' but retain
everything in between.
This way works fine
$X=~s/^#(.*?) END$/$1/; # $X is now SOME_STRING
But this way does not