Regex - replace example fails for more than 6 digits

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Dec 26 13:16:26 PST 2012


12/26/2012 9:26 PM, Peter Summerland пишет:
> I tried the example from the std.regex documentation:
>
> //Comify a number auto
> com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g");
> assert(replace("12000 + 42100 = 54100", com, ",") == "12,000 + 42,100 =
> 54,100");
>
> It did not work for me when I entered numbers with more than 6 digits.
> Using \d{3} instead of \d\d\d worked in all cases. The issue appears to
> be in the lookahead, not the lookbehind.
[snip]

>
> Am I missing something, or is this a bug?
>

It is and is something new (or a regression). Please go ahead and file it:

http://d.puremagic.com/issues/

Meanwhile I'll try to fix this before we get 2.061 out the door.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list