03 September 2012

Oreilly Second Edition of Regular Expressions Cookbook


I was reading the free sampler of this new edition and paid my attention the reference to Recipe 6.7:

So I tested it, but it doesn't work as expected:

String regexp = "(?:429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6]?[0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8]?[0-9]{7}|4[01][0-9]{8}|3[0-9]{9}|2[2-9][0-9]{8}|21[5-9][0-9]{7}|214[89]?[0-9]{6}|2147[5-9][0-9]{5}|214749[0-9]{4}|214748[4-9][0-9]{3}|2147483?[7-9][0-9]{2}|21474836[5-9][0-9]|214748364[89])"; 

String text = "214748364 8 2147483648 2147483650 4294967295";

I get the following results:

214748364
214748364
214748365
4294967295

is this a typo in the book or maybe RegexMagic is wrong.

http://www.regexguru.com/

Regards,

German

No comments :

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.