I have searched the site for this simple problem but cant find an answer.
I have a multiline string . I want to add a constant string to end of each line.
I am using Regex.Replace but facing problems. I tried to replace as the following.
Pattern Replace With
-------------------------------------------
$ Text
($) Text$1
\n Text
\n Text\n
(\n) Text$1
But none of these work. In all the cases the multiple lines are joined into a single line.
How can I accomplish this ?
You should be able to do:
string newString = oldString.Replace("\r\n", "Text\r\n");replace Text with the string you want to append to the end of each line