0

因此,我想在我的白名单中添加一些内容,以便阻止以前缀开头a且不继续的内容。b

例子:

a.b.blah -> Good
a.c.blah -> Bad, should be blocked

我不确定如何编写那个特定的正则表达式。任何指针?

4

1 回答 1

0

Say you have the string "a b", you can use /a(?= *b)/. Note that the space is in (?= ) so that it's not returned as part of the match. That will see if it follows.

If you don't want it to follow, use /a(?! *b)/.

于 2012-10-02T22:28:15.560 回答