S
Sin Jeong-hun
I'm trying to replace \n with @(representing the actual new line
character). Of course, \\n should not be replaced. What I'm trying to
do is simply what the good-old printf does.
For example, "\\n \n" should be converted to "\\n @". I used,
Regex r = new Regex(@"[^\\](\\n)");
textBox2.Text = r.Replace(textBox1.Text, "@");
But the result was "\\n@". It looks like one character before \n is
also treated as a character to be replaced. How can I fix this? Again,
the correct result is "\\n @".
Thank you.
character). Of course, \\n should not be replaced. What I'm trying to
do is simply what the good-old printf does.
For example, "\\n \n" should be converted to "\\n @". I used,
Regex r = new Regex(@"[^\\](\\n)");
textBox2.Text = r.Replace(textBox1.Text, "@");
But the result was "\\n@". It looks like one character before \n is
also treated as a character to be replaced. How can I fix this? Again,
the correct result is "\\n @".
Thank you.