// using System.Text.RegularExpressions; public static bool WildcardMatch(string pattern, string aString) { Regex regex = new Regex(WildcardToRegex(pattern), RegexOptions.IgnoreCase); return regex.IsMatch(aString); } public static string WildcardToRegex(string pattern) { return "^" + Regex.Escape(pattern). Replace("\\*", ".*"). Replace("\\?", ".") + "$"; }
274900cookie-checkC# Wildcard match