私が現在持っている正規表現のコードは、大文字と小文字が完全に一致するものを探すので、大文字と小文字を無視するにはどのような変更を加える必要がありますか?
public static bool ExactMatch(string input, string match)
{
return Regex.IsMatch(input, string.Format(@"\b{0}\b", Regex.Escape(match)));
}
これはうまくいくはずです:
public static bool ExactMatch(string input, string match)
{
return Regex.IsMatch(input, string.Format(@"\b{0}\b", Regex.Escape(match)), RegexOptions.IgnoreCase);
}
RegexOption.IgnoreCaseはオプションである必要があります..
Regex.IsMatch(input, string.Format(@"\b{0}\b", Regex.Escape(match)), RegexOptions.IgnoreCase)