Match all lines without the word "allow" in them

Possible duplicate:
Java \ Pattern - how to write a pattern that checks for a missing string?

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

+4
source share
1 answer
 /^(?!.*authorize).*/ 

A negative lookup is used here to ensure that the generic pattern will only match if the "authorize" expression cannot match anywhere in the input file.

+10
source

Source: https://habr.com/ru/post/1314746/


All Articles