Regex.Match整個單詞在C#,我想使用正則表達式來匹配任何這些單詞:string keywords = "(shoes|shirt|pants)";我想在內(nèi)容字符串中找到整個單詞。我以為這樣regex做會:if (Regex.Match(content, keywords + "\\s+", RegexOptions.Singleline | RegexOptions.IgnoreCase).Success){ //matched}但是對于像這樣的單詞participants,它會返回true ,即使我只想要整個單詞pants。我如何僅匹配那些文字?
- 3 回答
- 0 關(guān)注
- 363 瀏覽
添加回答
舉報
0/150
提交
取消