Regex lookahead example not as stated in Camel 4th

Yitzchak Scott-Thoennes sthoenna at gmail.com
Wed Jun 19 16:00:02 BST 2013


On Wed, Jun 19, 2013 at 7:28 AM, Bob MacCallum <uncoolbob at gmail.com> wrote:
> so, forgetting the typo for a moment, why doesn't it output
> 012
> 012
> 012
> 012
> ...
> ?
>
> 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.

It's not as simple as moving by one after each match; when it goes to
match it won't allow a 0-length match at the same position as the
previous 0-length match.

http://perldoc.perl.org/5.12.5/perlre.html#Repeated-Patterns-Matching-a-Zero-length-Substring


More information about the london.pm mailing list