Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ File Filters

I was wondering if it was possible to list an exclusion within the file filters in the "find in files" functionality of Notepad++.

For example the following will replace Dog with Cat in all files.

Find what: Dog

Replace with: Cat

Filters: *.*

What I would like to do is replace Dog with Cat in all files except those in .sh files.

Is this possible?

like image 657
Denis Sadowski Avatar asked Feb 02 '10 22:02

Denis Sadowski


1 Answers

I think something like a "negative selector" does not exist in Notepad++.

I took a quick look at the 5.6.6 source code and it seems like the file selection mechanism boils down to a function called getMatchedFilenames() which recursively runs through all the files below a certain directory, which in turn calls the following function to see whether the filename matches the pattern:

bool Notepad_plus::matchInList(const TCHAR *fileName, const vector<generic_string> & patterns)
{
    for (size_t i = 0 ; i < patterns.size() ; i++)
    {
        if (PathMatchSpec(fileName, patterns[i].c_str()))
            return true;
    }
    return false;
}

As far as I can determine, PathMatchSpec does not allow negative selectors.

It is however possible to enter a list of positive filters. If you could make that list long enough to include all the extensions in your directory except .sh, you're also there.

Good luck!

like image 184
littlegreen Avatar answered Oct 09 '22 14:10

littlegreen