OneDrive Client written in D

Dmitry Olshansky via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Sep 26 01:31:01 PDT 2015


On 25-Sep-2015 22:37, skilion wrote:
> On Friday, 25 September 2015 at 07:40:18 UTC, Dmitry Olshansky wrote:
>> Removing anonymous groups and using raw-literal:
>>
>> regex(`^\s*(\w+)\s*=\s*"(.*)"\s*$`)
>>
>> Looks simpler I guess.
>
> Good advice, thanks.
>
>> Though if key="value" is expected I'd suggest to use lazy .* -
>> `"(.*?)"` to stop on first " if any.
>
> After playing a bit with it, I realized that it doesn't work in this
> case (a="a"a" still match). The right solution would be "(.[^"])"

I hope that was ([^"]*)

Yeah, .*? won't work because of '$' at the end of the pattern.
Anyway to allow classical escapes in string literal I'd go for:

`"(?:[^"]+|\")*"`

-- 
Dmitry Olshansky


More information about the Digitalmars-d-announce mailing list