0

我正在尝试编写一个匹配所有不包含特定模板的字符串的正则表达式模板。

例如:

火柴:

This is my friend. He is very nice. 

This is my friend. He is very nice. 

但不匹配任何内容:

  This is my friend John Michaels Fredrickson. He is very nice. 

因为它包含这样的内容:([AZ][az]+\s?){3}

4

1 回答 1

1

您可以使用负前瞻:

^(?!.*?([A-Z][a-z]+\W){3}).*$

正则表达式演示

于 2014-11-17T14:58:05.933 回答