In the \"Advanced Regular Expresssion\" chapter in Mastering Perl, I have a broken example for which I can\'t figure out a nice fix. The example is perhaps trying to be too clev
I don't think this is what you are after (especially becaue the negative look-behind assertion has been dropped), but I guess, your only option is to slurp up the decimal places like in this example:
s/
(?:
(?<=\d)
(?=(?:\d\d\d)+\b)
|
( \d{0,3} \. \d+ )
)
/ $1 ? $1 : ',' /exg;
P.S. I think it is a good example when not used as the first one in the book, as it demonstrates some of the pitfalls and limitations of look-around assertions.