using System.Text.RegularExpressions;
private static readonly Regex _regexCrLf = new Regex(@"\r\n|\n|\r");
public static void Main()
var s = "タブ\tCRLF\r\nCR\rLF\nLFCR\n\rベル\a終了";
Console.WriteLine("== 修正前 ==");
s = _regexCrLf.Replace(string.Join(string.Empty, from c in s where !char.IsControl(c) || c == '\n' || c == '\r' select c), "\n").Normalize();
Console.WriteLine("== 修正後 ==");
Console.WriteLine("== コード ==");
Console.WriteLine(string.Join(";", s.ToCharArray().Select(c => ((int)c).ToString("X4"))));