On Wed, Jun 19, 2013 at 02:36:14PM +0100, gvim wrote:
> The 4th edition of the Camel states:
>
> *****************************
> "0123456789" =~ /(\d{3})/g
>
> returns only three strings: 012, 345, and 678. By wrapping the capture  
> group with a lookahead assertion:
>
> "0123456789" =~ /(?:(\d{3}))/g
>
> you now retrieve all of 012, 123, 234, 345, 456, 567, 678, and 789.
>
> ******************************
>
> Howevery, my test with perl 5.14.2 on Ubuntu 13.04 does not concur:
>
> $ perl -E 'say for "0123456789" =~ /(\d{3})/g'
> 012
> 345
> 678
>
> $ perl -E 'say for "0123456789" =~ /(?:(\d{3}))/g'
> 012
> 345
> 678


That's not a lookahead assertion. This is:

  $ perl -wE 'say for "0123456789" =~ /(?=(\d{3}))/g'
  012
  123
  234
  345
  456
  567
  678
  789
  $


Regards,


Abigail

Reply via email to