Regex lookahead example not as stated in Camel 4th

Bob MacCallum uncoolbob at gmail.com
Wed Jun 19 15:28:44 BST 2013


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.






On Wed, Jun 19, 2013 at 3:02 PM, gvim <gvimrc at gmail.com> wrote:

> On 19/06/13 14:52, Abigail wrote:
>
>
>> That's not a lookahead assertion. This is:
>>
>>    $ perl -wE 'say for "0123456789" =~ /(?=(\d{3}))/g'
>>    012
>>    123
>>    234
>>    345
>>    456
>>    567
>>    678
>>    789
>>    $
>>
>>
>>
> So there's a typo on p.248
>
> gvim
>


More information about the london.pm mailing list