I'm using Regex to search specific words
var item = "If ";
string str = "If .DataFound Then";
Regex regex = new Regex("\\b"+ item + "\\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
var count = regex.Matches(str).Count;
count return 0. expected result is 1.
"If " with space is intended. standard string is ok, but if we have period just like above example, it doesn't count.