Programming Windows D Examples are now Online!
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu Jun 23 10:04:48 PDT 2011
On 6/23/11, Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:
> On 23.06.2011 9:58, Andrej Mitrovic wrote:
>> Fixed:
>> https://github.com/AndrejMitrovic/DWindowsProgramming/commit/42228c9012c2c75d2638fab52277f21427b2ed01
>>
>> Quite a huge list of stray parens. Good thing I had Beyond Compare for
>> the diffs.
> Seems like I'm late for regex party :(
> Still, this works in D2, and is somewhat intelligent ;)
>
> import std.regex, std.file;
>
> void main(string[] args)
> {
> auto r = regex(`(\W\s*)\(("(?:[^"]|\\")*")\)`,"g");
> foreach(arg; args[1..$])
> {
> auto data = cast(string)read(arg);
> auto replaced = replace(data, r, `$1$2`);
> std.file.write(arg, replaced);
> }
> }
>
> --
> Dmitry Olshansky
>
>
Thanks, goes into my d_tips.txt file. :)
More information about the Digitalmars-d-announce
mailing list