I have this function to extract all words from text
public static string[] GetSearchWords(string text)
{
string pattern = @"\S+";
Regex re = new Regex(pattern);
MatchCollection matches = re.Matches(text);
string[] words = new string[matches.Count];
for (int i=0; i<matches.Count; i++)
{
words[i] = matches[i].Value;
}
return words;
}
and I want to exclude the list of words from the returned array, the list of words is as follows
string strWordsToExclude="if,you,me,about,more,but,by,can,could,did";
How to change the function above to avoid returning the words that are on my list.
source
share