Regex lookahead example not as stated in Camel 4th

Gianni Ceccarelli dakkar at thenautilus.net
Wed Jun 19 14:59:13 BST 2013


I'd say typo in the book. A "look-ahead assertion" looks like C<< (?=
) >> (note C<=> instead of C<:>). C<< (?:  ) >> is just a
non-capturing group.

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

-- 
	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint = A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id = 0x75193F88

Storms beget storms.  Rage begets rage.
Revenge begets revenge. Wars beget wars.

  -- Bene Gesserit Conundrum
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://london.pm.org/pipermail/london.pm/attachments/20130619/0aa7e3ea/signature.pgp


More information about the london.pm mailing list