标签: regex bash grep mocha negative-lookahead
我需要匹配包含值@a,@b或@c的字符串。 但是,如果其中任何一个字符串还包含@no值,则将其视为无效。
@a
@b
@c
@no
使用mocha和--grep参数运行单元测试是必需的。
mocha
--grep
当前版本如下
(?!.*@no.*)(@a|@b|@c)
如果@no过滤后没有所需的键,则工作正常。
test @a @a @no test @a @b @no
但是如果有的话-表达式就匹配了。
test @a @no @b @no @a