On Monday 27 September 2010 12:21:51 hpant pant wrote:
> Hi ,
> can anyone explain me, how below code works ,dealing with nested patterns.
> i am not able to understand the ((?:(?!BEGIN)(?!END).)*) part.
>
> while (s/BEGIN((?:(?!BEGIN)(?!END).)*)END//gs) {
> # do something with $1
> }
?! is a zero-width negative look-ahead assertion (see
http://perldoc.perl.org/perlre.html although it's not very accessible). I
believe what the pattern means is to match everything between BEGIN and END
which does not contain either "BEGIN" or "END".
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
My Favourite FOSS - http://www.shlomifish.org/open-source/favourite/
<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/