SyntaxFix
Write A Post
Hire A Developer
Questions
Simple variant:
Regex.Replace(input, @"\r\n|\r|\n", "\r\n")
For better performance:
static Regex newline_pattern = new Regex(@"\r\n|\r|\n", RegexOptions.Compiled); [...] newline_pattern.Replace(input, "\r\n");