How to exclude folders which contain a pattern except when under a certain folder?

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Tony2022
Posts: 3
Joined: Sat Jan 29, 2022 6:27 pm

How to exclude folders which contain a pattern except when under a certain folder?

Post by Tony2022 »

I want to exclude all \node_modules\ folders from search but include it if it's under a certain folder. How do I do this?
void
Developer
Posts: 16671
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to exclude folders which contain a pattern except when under a certain folder?

Post by void »

Please try the following negative lookahead regex exclude filter:

regex:^(?!c:\\foldera|d:\\folderb|e:\\folderc).*\\node_modules$

where c:\\foldera, d:\\folderb and e:\\folderc are the folders to keep.
Use double backslash (\\) for a single literal backslash with regex.



Add this as an exclude filter under Tools -> Options -> Exclude -> Add filter
-or-
Add this as a result omission under Index -> Add Omit Result Filter...



Tools -> Options -> Exclude will exclude these files/folders from your index and require a database rebuild.
Add Omit Result Filter can be toggled instantly and doesn't require the rebuild.
Tony2022
Posts: 3
Joined: Sat Jan 29, 2022 6:27 pm

Re: How to exclude folders which contain a pattern except when under a certain folder?

Post by Tony2022 »

Thanks.
Post Reply