使用正则表达式的确切WordMatch [英] exact WordMatch using Regex

查看:73
本文介绍了使用正则表达式的确切WordMatch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
请帮助我,因为我正尝试使用正则表达式匹配字典中的确切单词,但在某些情况下会失败,比如说我的字典中有单词"don"但它也匹配单词"don" t"而我没有希望他不要匹配.我正在使用正则表达式

Hi All,
Please help me as i am trying to match exact word from my dictionary using regex but in some cases it fails, like let say i have word "don" in my dictionary but it also matches the word "don''t" and i dont want "don''t" to he matched. I am using regex

@"\b({0})\b"

进行匹配.
谢谢大家的帮助.

to match.
Thanking you all for the help in advance.

推荐答案

这可能对您有所帮助
http://stackoverflow.com/questions/2621396/net-regular-expression-how-to-to-do-an-exact-match-exclusion-on-a-full-string [
This may help
http://stackoverflow.com/questions/2621396/net-regular-expression-how-to-do-an-exact-match-exclusion-on-a-full-string[^]

if this doesn''t help try
@"\b(^{0}


)\ b"


这篇关于使用正则表达式的确切WordMatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆