I need a regexp that will match everything except a single constant (case ignored)
Example for constant ALL, should match words like: dog, MOUSE, mall, alligator. But it shouldn't match: all, ALL, alL.
I need a regexp that will match everything except a single constant (case ignored)
Example for constant ALL, should match words like: dog, MOUSE, mall, alligator. But it shouldn't match: all, ALL, alL.
(?si)^(?!all$).*
will match any string except all
(case-insensitively).
(?i)
makes the regex case-insensitive, (?s)
allows the dot to match any character, including newlines. If you don't expect newlines in your input, you can remove the s
.
See it live on regex101.com.