The fact that regex doesn’t support inverse matching is not entirely true. You can mimic this behavior by using negative look-arounds:
1 ^((?!hede).)*$
The regex above will match any string, or line without a line break, not containing the (sub) string ‘hede’.As mentioned, this is not something regex is “good” at (or should do), but still, it is possible.
Explanation
“Regular expression to match string not containing a word.”Continue reading