Does notepad++ support a "find not" function?

  • Let’s say I have a LARGE file with many records with the same or similar content.
    Is there a way to look for records which do NOT contain that content?
    Example - File with the following records:

    • list itemThis record has the word something in it
      This record also has the word something in it
      This record contains different context
      This final record contains the word something again

    I want to find the record without the word “something” in it.
    Is there something like “find [not] something” ?

  • @Peter-Cohen
    you can find and/or replace any lines/records which do not contain a certain string using regular expressions.

    to find all lines which do not contain the string “pluto once was a planet” select regular expression as search mode in the notepad++ find or replace window
    then use following regex search string to find all lines which do not contain the string:

    ^(?!.*pluto once was a planet)(.*?)$

    regex looks complicated at first, but normally you only have to modify the string part in templates like this one.

    once gotten used to it it’s quite cool, because we can automatically search and replace almost anything, even if it is as complicated as “if a line or part between 1 and 2 contains abc, but not def, except if ghi is found, then replace the string part between 1 and 2 or the string part between beginning and end of the line with xyz”

  • Holy Cow - looking at that expression there is a good reason Pluto is not a planet anymore :-(.
    Guess I’ll have to read up on regex - thanks for your response.

  • You could use the “Mark” tab in the search and replace dialogue. Have Bookmark line ticked. Search for the lines that have the string, then use menu => Search => Bookmark => Inverse bookmark**. Now the lines that do not match the search string are bookmarked. The Bookmark menu has several other commands for manipulating the (un)marked lines.

Log in to reply