fork(5) download
  1. using System;
  2. using System.IO;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var s = "Line1\rLine2\r\nLine3";
  10. var res = Regex.Replace(s, "\r(?!\n)", "\r\n");
  11. Console.WriteLine(res.Replace("\r","CR").Replace("\n","LF\n"));
  12. }
  13. }
Success #stdin #stdout 0.03s 30648KB
stdin
Standard input is empty
stdout
Line1CRLF
Line2CRLF
Line3