Re: Regex lookahead problem

2005-01-14 Thread Andrew Black
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

Re: Regex lookahead problem

2005-01-14 Thread Dave Gray
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

Regex lookahead problem

2005-01-11 Thread Ramprasad A Padmanabhan
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

Re: Regex lookahead problem

2005-01-11 Thread Jenda Krynicky
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