How is std.regex.replaceAllInto more efficient?
Shriramana Sharma via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 17 03:06:30 PDT 2015
Dmitry Olshansky wrote:
> Feel free to improve on the examples, I'd gladly pull such patches.
How about this, using the "comifying" regex from the replaceAll example:
auto re = ctRegex!(`(?<=\d)(?=(\d\d\d)+\b)`, "g");
auto sink = appender!(char [])();
foreach (line; stdin.byLine())
{
sink.clear();
replaceAllInto(sink, line, re, ",");
writeln(sink.data());
}
--
Shriramana Sharma, Penguin #395953
More information about the Digitalmars-d
mailing list