How to exclude a specific string constant?
You have to use a negative lookahead assertion. You could for example use the following. If this does not work in your editor, try this. It is tested to work in ruby and javascript:
You have to use a negative lookahead assertion. You could for example use the following. If this does not work in your editor, try this. It is tested to work in ruby and javascript:
The caret in the character class ([^) means match anything but, so this means, beginning of string, then one or more of anything except < and >, then the end of the string.
The notion that regex doesn’t support inverse matching is not entirely true. You can mimic this behavior by using negative look-arounds: 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 … Read more