How can I check my text if it contains any of the array content as words not "texting"?
string text = "some text here";
string[] array1 = { "text", "here" };
string[] array2 = { "some", "other" };
I've found this code on SO how can I adapt it?
string regexPattern = string.Format(@"\b{0}\b", Regex.Escape(yourWord));
if (Regex.IsMatch(yourString, regexPattern)) {
// word found
}
Also is regex the best approach for this work? Or should I use a foreach loop?
array1andarray2)?