I have a list of words:

  • Alpha
  • Beta
  • Charlie
  • Delta
  • Echo

And a list of 1000 multi-line files. One or more of these files contains all 5 of the words, the others contain 4 or fewer. The words can appear in the files in any order. However, each word only appears once in each file.

I need to find the one or more files which contain all 5 words.

I am trying lots of regex to plug into "find in files" in notepad++ but I cannot make it work. Trying for one hour now.

  • Ctrl+Shift+H
  • Find what: \A(?=.*\bAlpha\b)(?=.*\bBeta\b)(?=.*\bCharlie\b)(?=.*\bDelta\b)(?=.*\bEcho\b)
  • CHECK Match case
  • CHECK Regular expression
  • CHECK . matches newline
  • Find All


\A                      # beginning of file
(?=                     # positive lookahead, make sure we have after:
    .*                      # 0 or more any character
    \b                      # word boundary
    Alpha                   # word to search
    \b                      # word boundary
)                       # end lookahead
(?=.*\bBeta\b)          # same for 2nd word
(?=.*\bCharlie\b)       # same for 3rd word
(?=.*\bDelta\b)         # ...
(?=.*\bEcho\b)          # ...

This makes sure we have all the 5 words in any order in the files.


enter image description here

  • Awesome that works thank you!! – tom redfern Jan 16 at 12:01
  • @tomredfern: You're welcome, glad it helps. – Toto Jan 16 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.