I have looked at several posts including this question which is asking essentially the same thing, but was wrongly closed (IMO) as the close rational cites a question. asking about sub-strings within a string i.e. strings that contain one sub-string, but not another.
So I am re-posting the request here in hopes that there is a way using a single regular expression to identify within a large collection of files, those files that contain eg. "string1" , but do not contain "string2".
I am using the regular expression implementation integrated into the Sublime Text (Build 4126) to search a collection of files, and return only those files which contain at least one instance of eg. string1
and zero instances of string2
.
The closest I have come to finding what I am looking for comes from the accepted answer in this question (same as linked above.)
^(?!.[\s\S]*MISSING_TERM).[\s\S]*INCLUDED_TERM.*$
But as stated above, this only targets sub-strings within a string, not a collection of files. When I tried it on my collection of files, it found files that contained both strings rather than files that did not include the 2nd string.