Community
Participate
Working Groups
Eclipse search currently does not support file name pattern exclusion. The only way to exclude certain file types from a search is to specify all the other file types in your file search scope. I would like to propose support for the concept of "NOT" Boolean logic within file name search pattern strings. For example: 1. If one wanted to search for content within all files in the workspace/project except for *.log files one could simply enter "!*.log" as the file name search patter. 2. If one wanted to search for content within all files except for *.log and *.xml files one would enter "!*.log, !*.xml" as their file name search patter. 3. If one wanted to search for content within *.xjl files but not *.xml files or *.xsl, one would enter "!*.x*l, *.xjl" I have already implemented this enhancement and I'm using it for my own needs. I would be more than happy to submit a patch to the Eclipse search plug-in project if there's interest in the enhancement.
We'd be happy to use have a look at patch! Try to keep is as minimal as possible, then the chance is high that I can release it as is.
*** Bug 136193 has been marked as a duplicate of this bug. ***
The example 3 in comment 1: "!*.x*l, *.xjl" does not make sense, as just "*.xjl" should suffice. The tough question is, what do we do with files that match both a positive and a negative pattern? For example does "*.a? !*.?b" match the file "test.ab". Solution 1 (first match wins): test.ab is searched, because *.a? is the first pattern that matches. Solution 2 (last match wins): test.ab is not searched, *.?b is the last pattern that matches and is negated. Solution 3 (order independent): test.ab is not searched as there is a negative pattern that matches. I prefer solution 3, because it is easily explained: A file is searched if it matches at least one positive pattern and no negative pattern. If there is no positive pattern the pattern '*' may implicitly be added.
Created attachment 38503 [details] implements solution 3 In the absence of any comment I chose to implement solution 3.
Apologies for the late response. I original had an patch for Eclipse 3.1 search plug-in release. Things have changed quite a bit for the 3.2 search plug-in release. I'll need to do some catching up.
You're right, example 3 doesn't indeed make sense at all. As for what we do with files that match both a positive and a negative pattern I am in favor of having inclusion taking precedence over exclusion by default. More often than not user expectation will be the inclusion of hits matching their inclusion pattern. Perhaps there should be an option (check-box) to specify the precedence. (In reply to comment #3) > The example 3 in comment 1: "!*.x*l, *.xjl" does not make sense, as just > "*.xjl" > should suffice. > > The tough question is, what do we do with files that match both a positive and > a negative pattern? For example does "*.a? !*.?b" match the file "test.ab". > > Solution 1 (first match wins): > test.ab is searched, because *.a? is the first pattern that matches. > > Solution 2 (last match wins): test.ab is not searched, *.?b is the last > pattern that matches and is negated. > > Solution 3 (order independent): test.ab is not searched as there is a negative > pattern that matches. > > I prefer solution 3, because it is easily explained: > A file is searched if it matches at least one positive pattern and no negative > pattern. If there is no positive pattern the pattern '*' may implicitly be > added. >
patch released > 20060416 Thanks Markus! For the bookkeeping: that this a search polish that I couldn't release at time in RC1.
*** Bug 86962 has been marked as a duplicate of this bug. ***