In C# , I want to use a regular expression to match any of these words:
string keywords = "(shoes|shirt|pants)";
I want to find whole words in the content bar. I thought this regex would do this:
if (Regex.Match(content, keywords + "\\s+", RegexOptions.Singleline | RegexOptions.IgnoreCase).Success) {
but it returns true for words like participants , although I only need the word pants .
How do I match only these literal words?
Kris B Jul 30 '09 at 20:11 2009-07-30 20:11
source share