using System; using System.Text.RegularExpressions; public class RegexTest { private static void TestInputPattern(string input, string pattern) { Console.WriteLine("Input: {0}, Pattern: {1}", input, pattern); Console.WriteLine("IsMatch: {0}", Regex.IsMatch(input, pattern)); } public static void Main() { string input = "this potato"; string groupedPattern = "^(?:this|that)$"; string ungroupedPattern = "^this|that$"; TestInputPattern(input, groupedPattern); TestInputPattern(input, ungroupedPattern); } }