@mkupper said in Notepad++ Regex to find files having more than 2 words but should exclude certain word:
It turns out that the not scanner, (?!word3a|word3b) only works on lines, not files, even if you try ``(?-s)(?!word3a|word3b).
You’re misunderstanding what is going wrong. The expression you gave says, “Match null here if the following characters aren’t either word3a or word3b.” That matches at every position in a file except immediately before word3a or word3b. (Each line is listed once in the search results, but look at the number of hits.) What is needed is (?s)\A(?!.*(word3a|word3b)), which says, “Match null at the beginning of the document if the following characters don’t match any number of arbitrary characters followed by either word3a or word3b.”
When I tested the whole expression I got some erratic results when I had it match null, which is why I set it to match the string from the beginning up to the word word1.