regex - Regular expression to match a line that doesn't contain a word - Stack Overflow
The notion that regex doesn't support inverse matching is not entirely true. You can mimic this behavior by using negative look-arounds:
^((?!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.
And if you need to match line break chars as well, use the DOT-ALL modifier (the trailing s
in the following pattern):
Read full article from regex - Regular expression to match a line that doesn't contain a word - Stack Overflow
No comments:
Post a Comment