On Thursday, 9 March 2017 at 16:23:23 UTC, Adam D. Ruppe wrote:
On Thursday, 9 March 2017 at 16:14:28 UTC, Suliman wrote:
But now output is:
[["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]]

But I do not \r\n\ symbols...

That's just the writeln array formatter. The matchFirst function returns an array of hits (that allows captures, btw you might need to use \( instead of ( to get the capture, god i hate regex) so writeln tries to print the whole array and that's how it does embedded newlines.

So you have the correct result, just written strangely.

How should I write to file result without \r\n\ symbols?

auto x = content.matchFirst(bigCodeBlock);

File f = File("foo.txt", "w");
f.write(x);

foo.txt:
["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]

Reply via email to