fork 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.\r\nLine2.\rLine3.\nLine4\r\nLine5";
  10. var rx_R = @"(?:\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029])";
  11. var res = Regex.Replace(s, $@"(\.{rx_R})|{rx_R}", "$1");
  12. Console.WriteLine(res);
  13. Console.WriteLine(res.Replace("\n", "LF").Replace("\r", "CR"));
  14. }
  15. }
Success #stdin #stdout 0.04s 134720KB
stdin
Standard input is empty
stdout
Line1.
Line2.
Line3.
Line4Line5
Line1.CRLFLine2.CRLine3.LFLine4Line5