// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text.RegularExpressions; namespace E { public class Program { public static void Main(string[] args) { string s1 = "def" + Environment.NewLine + "ghi"; bool b1 = Regex.IsMatch(s1, "^def$", RegexOptions.Multiline); Console.WriteLine(b1); string s2 = "abc" + Environment.NewLine + "def"; bool b2 = Regex.IsMatch(s2, "^def$", RegexOptions.Multiline); Console.WriteLine(b2); string s3 = "def\nghi"; bool b3 = Regex.IsMatch(s3, "^def$", RegexOptions.Multiline); Console.WriteLine(b3); string s4 = "abc\ndef"; bool b4 = Regex.IsMatch(s4, "^def$", RegexOptions.Multiline); Console.WriteLine(b4); } } }