尝试:
/^(?!.*foobar)/.test('foobar@bar.de')(简短)说明:
^ # start of the string (?! # start negative look-ahead .* # zero or more characters of any kind (except line terminators) foobar # foobar) # end negative look-ahead
因此,用简单的英语来说,如果可以“看到”字符串“foobar”,则该正则表达式将从字符串开头开始查找。如果可以“看到”,则 没有 *匹配项。
*没有匹配项,因为它是 负面 的超前预测!



