No such thing as a small change | |
PerlMonks |
Re: Why isn't this regex greedy?by kettle (Beadle) |
on Mar 17, 2006 at 10:33 UTC ( [id://537424]=note: print w/replies, xml ) | Need Help?? |
I may be totally off my rocker here but I think that perl will interpret:
exactly the same way it interprets your code from expression #1:
(note the missing set of parentheses on the top, modified version of your expression) The output of both is, in any case, the same. The salient point being that perl is not including the in the backreference - thus making the expression non-greedy...? There is a great little blurb on positive and negative lookahead that you might take a look at: http://www.regular-expressions.info/lookaround.html wonder if that makes sense....
In Section
Seekers of Perl Wisdom
|
|