using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; public class Test { public static void Main() { var s = "abcde\n fghij"; var rx = @"(.*)"; var res1 = Regex.Match(s, rx, RegexOptions.Singleline); if (res1.Success) { Console.WriteLine(res1.Groups[1].Value); } rx = @"(.*)"; var res2 = Regex.Match(s, rx, RegexOptions.Singleline); if (res2.Success) { Console.WriteLine(res2.Groups[1].Value); } } }