Regex.IsMatch("Hello1 Hello2", "\bHello\b");
Something like this method below should work for you every time:
static bool ExactMatch(string input, string match)
{
return Regex.IsMatch(input, string.Format(@"\b{0}\b", Regex.Escape(match)));
}
No comments:
Post a Comment