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

Reply via email to