可能重复:
Java \ Pattern - how to write a pattern that verifies the lack of a string?匹配的所有字符串无字“授权”在他们
我怎么能匹配无字通过正则表达式在其中“授权”的所有字符串?我试图*(authorize){0}*
无济于事。
可能重复:
Java \ Pattern - how to write a pattern that verifies the lack of a string?匹配的所有字符串无字“授权”在他们
我怎么能匹配无字通过正则表达式在其中“授权”的所有字符串?我试图*(authorize){0}*
无济于事。
/^(?!.*authorize).*/
这将使用negative lookahead,以确保整体格局将匹配只有表达式“授权”不能在任何地方输入匹配。
这是perl特有的吗? – 2010-07-05 16:41:35
大多数现代的正则表达式引擎执行积极和消极的前瞻断言。 – Amber 2010-07-05 17:58:30
为什么使用正则表达式呢? – Stephen 2010-07-05 16:36:43
你应该投入一个小时并阅读教程,例如http://www.regular-expressions.info/;你的模式没有意义。 – polygenelubricants 2010-07-05 16:37:27