string keyword="ankit";
string str="my name is ankit";
if (Regex.Match(str.Trim().ToLower(), @"\b" + keyword.Trim().ToLower() + @"\b", RegexOptions.Singleline | RegexOptions.IgnoreCase).Success)
{
// if matches
}
else
{
// if not matches
}
Here, in 'if' condition "Success" is used to the condition is true or not, just like "==true"
No comments:
Post a Comment