且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

正则表达式匹配整个单词

更新时间:2022-01-07 21:47:06

您应该在正则表达式中添加定界符:

You should add the word delimiter to your regex:

\b(shoes|shirt|pants)\b

在代码中:

Regex.Match(content, @"\b(shoes|shirt|pants)\b");