static private CreatePredicateFromWildcards ( string pattern, RegexOptions opt ) : bool>.Func |
||
pattern | string | |
opt | RegexOptions | |
return | bool>.Func |
static Func<string, bool> CreatePredicateFromWildcards( string pattern, RegexOptions opt )
{
string r = "^" + Regex.Escape( pattern ).Replace( @"\*", ".*" ).Replace( @"\?", "." ) + "$";
Regex re = new Regex( r, opt );
return re.IsMatch;
}