Regex lookahead example not as stated in Camel 4th

Aaron Crane perl at aaroncrane.co.uk
Wed Jun 19 15:53:31 BST 2013


Bob MacCallum <uncoolbob at gmail.com> wrote:
> From my reading of the 5.12 perlre docs, there is no mention of moving the
> cursor along by one position after each match.
> Maybe that is a more general thing I wasn't aware of.

Yes, though only when the match was zero-length.  This is done on the
grounds that an infinite loop would be a relatively unhelpful outcome
in such situations.

The documentation for this feature in 5.12 is here:

https://metacpan.org/module/LBROCARD/perl-5.12.4/pod/perlre.pod#Repeated-Patterns-Matching-a-Zero-length-Substring

but I suggest reading the latest version, as it's been expanded a
little (without any change to the underlying feature):

https://metacpan.org/module/RJBS/perl-5.18.0/pod/perlre.pod#Repeated-Patterns-Matching-a-Zero-length-Substring

-- 
Aaron Crane ** http://aaroncrane.co.uk/


More information about the london.pm mailing list