Closed GoogleCodeExporter closed 9 years ago
Further explanation:
I'm currently working on a web project and I want to exclude the jQuery
javascript framework ("jquery.js" file) and all SVG-files because their
appearance in many search results is very annoying.
I read in another issue that one can use "|" to specify multiple filters at
once and gathered some information about shell wildcards. I found something
useful on this page: http://www.tuxfiles.org/linuxhelp/wildcards.html
According to this I tried the following filter:
*.php|*.css|[!j]*.js
-> every PHP-file is searched
-> every CSS-file is searched
-> every JavaScript-file that doesn't begin with a "j" is searched
This works great in my specific situation but just because I don't have any
other JavaScript files that begin with a "j". Therefore it's not quite clean...
I also tried to work with "extglob" but to no avail. It seems that it's not
supported in advanced-find.
http://stackoverflow.com/questions/216995/how-can-i-use-inverse-or-negative-wild
cards-when-pattern-matching-in-a-unix-linu
Original comment by ir4o.o91...@gmail.com
on 21 Apr 2012 at 10:18
The file type filter is implement using grep.
Although grep support --include and --exclude parameters, but can't use both at
the same time.
grep seems not support extglob either.
It's easy to implement including/excluding file types, but I have no idea how
to do both at the same time.
Original comment by swatch.c...@gmail.com
on 23 Apr 2012 at 4:12
In my special case there is no need to do both at the same time, exclusion of
files would do the job. I would use this filter: *.svg|jquery.js
It would be cool if one could choose between inclusion and exclusion with a
checkbox or something similar.
By the way, this is a very useful plugin, thanks for providing...
Original comment by ir4o.o91...@gmail.com
on 23 Apr 2012 at 9:38
I just played around a little bit with grep and --include/--exclude and in my
opinion it is still possible to use both at the same time. This could be of use
for example if someone needs to search only for JavaScript files among a huge
amount of other files, but wants to exclude on specific .js file.
Here the output of my test:
me@me ~ $ grep --recursive "searchString" *
subfolder/anotherFile.2:searchString
subfolder/anotherFile.3:searchString
subfolder/fileToInclude.txt:searchString
subfolder/fileToExclude.txt:searchString
subfolder/anotherFile.1:searchString
me@me ~ $ grep --recursive --include=*.txt "searchString" *
subfolder/fileToInclude.txt:searchString
subfolder/fileToExclude.txt:searchString
me@me ~ $ grep --recursive --include=*.txt --exclude=fileToExclude.txt
"searchString" *
subfolder/fileToInclude.txt:searchString
I also found some helpful information in here:
http://stackoverflow.com/questions/221921/grep-exclude-include-syntax-do-not-gre
p-through-certain-files According to this one can use as many --include's and
--exclude's as needed. For example:
grep --recursive --exclude=*.svg --exclude=jquery.js "searchString" *
So you could implement two input boxes, one for the inclusion filter and one
for the exclusion filter, and they could be used at the same time. That would
be my proposal...
Original comment by ir4o.o91...@gmail.com
on 23 Apr 2012 at 10:48
Thanks for your information.
I will think how to do for this.
Original comment by swatch.c...@gmail.com
on 25 Apr 2012 at 3:26
Fixed at v3.4.0.
I don't want make things complicated.
Add '-' before the type you don't want to exclude it.
Original comment by swatch.c...@gmail.com
on 3 May 2012 at 4:03
Works. Now filters like
*.php|*.css|*.js|-jquery.js
can be used...
Thanks, it's really helpful!
Original comment by ir4o.o91...@gmail.com
on 3 May 2012 at 4:29
Original comment by swatch.c...@gmail.com
on 3 May 2012 at 4:51
Original issue reported on code.google.com by
ir4o.o91...@gmail.com
on 19 Apr 2012 at 2:29