I think the easiest way to do this would be to split the string into words, then check each word for a match, It could be done with a function like this:
private bool containsWord(string searchstring, string matchstring)
{
bool hasWord = false;
string[] words = searchstring.split(new Char[] { ' ' });
foreach (string word in words)
{
if (word.ToLower() == matchstring.ToLower())
hasWord = true;
}
return hasWord;
}
The code converts everything to lowercase to ignore any case mismatches. I think you can also use RegEx for this:
static bool ExactMatch(string input, string match)
{
return Regex.IsMatch(input.ToLower(), string.Format(@"\b{0}\b", Regex.Escape(match.ToLower())));
}
\b is a word boundary character, as I understand it.
These examples are in C#. You didn't specify the language