fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6.  
  7. static void Main()
  8. {
  9. string text = "text1, text2,te\nxt3, text4\r\ntext5";
  10.  
  11. System.Console.WriteLine("text='{0}'", text);
  12.  
  13.  
  14. string result = Regex.Replace(text, @"([^\r])\n", "$1");
  15.  
  16. System.Console.WriteLine("text='{0}'", result);
  17. }
  18. }
  19.  
Success #stdin #stdout 0.12s 24416KB
stdin
Standard input is empty
stdout
text='text1, text2,te
xt3, text4
text5'
text='text1, text2,text3, text4
text5'