Regex - replace example fails for more than 6 digits

Peter Summerland p.summerland at gmail.com
Wed Dec 26 14:15:00 PST 2012


On Wednesday, 26 December 2012 at 21:16:30 UTC, Dmitry Olshansky 
wrote:
> 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:

Done

>
> http://d.puremagic.com/issues/
>
> Meanwhile I'll try to fix this before we get 2.061 out the door.

Thanks for the great regex library!


More information about the Digitalmars-d-learn mailing list