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);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CgpwdWJsaWMgY2xhc3MgUmVnZXhUZXN0CnsKCXByaXZhdGUgc3RhdGljIHZvaWQgVGVzdElucHV0UGF0dGVybihzdHJpbmcgaW5wdXQsIHN0cmluZyBwYXR0ZXJuKQoJewoJCUNvbnNvbGUuV3JpdGVMaW5lKCJJbnB1dDogezB9LCBQYXR0ZXJuOiB7MX0iLCBpbnB1dCwgcGF0dGVybik7CgkJQ29uc29sZS5Xcml0ZUxpbmUoIklzTWF0Y2g6IHswfSIsIFJlZ2V4LklzTWF0Y2goaW5wdXQsIHBhdHRlcm4pKTsJCgl9CgoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCXN0cmluZyBpbnB1dCA9ICJ0aGlzIHBvdGF0byI7CgkJc3RyaW5nIGdyb3VwZWRQYXR0ZXJuID0gIl4oPzp0aGlzfHRoYXQpJCI7CgkJc3RyaW5nIHVuZ3JvdXBlZFBhdHRlcm4gPSAiXnRoaXN8dGhhdCQiOwoJCVRlc3RJbnB1dFBhdHRlcm4oaW5wdXQsIGdyb3VwZWRQYXR0ZXJuKTsKCQlUZXN0SW5wdXRQYXR0ZXJuKGlucHV0LCB1bmdyb3VwZWRQYXR0ZXJuKTsKCX0KfQ==