4

Possible Duplicate:
Java \ Pattern - how to write a pattern that verifies the lack of a string?

How can I match all strings without the word "authorize" in them via regular expressions? I tried *(authorize){0}* to no avail.

Community
  • 1
  • 1
benstpierre
  • 32,833
  • 51
  • 177
  • 288

1 Answers1

10
/^(?!.*authorize).*/

This uses a negative lookahead to ensure that the overall pattern will match only if the expression "authorize" cannot match anywhere in the input.

Amber
  • 507,862
  • 82
  • 626
  • 550