Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因此,我想在我的白名单中添加一些内容,以便阻止以前缀开头a且不继续的内容。b
a
b
例子:
a.b.blah -> Good a.c.blah -> Bad, should be blocked
我不确定如何编写那个特定的正则表达式。任何指针?
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.
"a b"
/a(?= *b)/
(?= )
If you don't want it to follow, use /a(?! *b)/.
/a(?! *b)/