Ruby Regex:拒绝整个单词
发布时间:2020-12-17 04:32:31 所属栏目:百科 来源:网络整理
导读:我知道在 Regex中,你可以拒绝符号列表,例如[^ abc].在我输入的中间看到一个完整的单词时,我想拒绝. 更确切地说,我想拒绝“print除了”all“”之外的任何东西. 几个例子: print all - matchfrokenfooster - no matchprint all nomnom - no matchprint bolloc
我知道在
Regex中,你可以拒绝符号列表,例如[^ abc].在我输入的中间看到一个完整的单词时,我想拒绝.
更确切地说,我想拒绝“print<除了”all“>”之外的任何东西. print all - match frokenfooster - no match print all nomnom - no match print bollocks - no match print allpies - no match 解决方法
你正在寻找
negative look-ahead.(参考文献
using look-ahead and look-behind)
(?!exclude) 会取消模式中“排除”一词的资格. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读