I want to filter emails by their subject. The subject should contain one phrase, but exclude words that I specified.

For example it should put all email messages with the subject USB 3.0 in a folder, but not with subjects like Notebook with USB 3.0 or USB 3.0 Hub.

So I tried to create a filter with the following in the subject box:

"USB 3.0" -(Notebook OR 2,5" OR Seagate OR RAID OR HDD OR TB OR Hub OR Bus OR WD OR "Western Digital")

My try isn't working. How can I do this?

2 Answers 2


I don't think Gmail filters will work with parentheses like that. I think you'll need to negate every term.

subject:"USB 3.0" -Notebook -"2,5" -Seagate -RAID -HDD -TB -Hub -Bus -WD -"Western Digital"

All that said, filters are generally just saved searches, so try searching for "USB 3.0" -Notebook and keep adding terms until you get back the results you want, then save it as a filter.


If you cannot get your search right by means of the regular Gmail filtering functionality, you have the option of using IMAP: Get all your email into a client (such as Mozilla Thunderbird) which features its own set of advanced filtering methods.

If you have really advanced filtering needs, you can resort to exporting your messages to a repository of local .eml files. You can search these using any program of choice, e.g., Emacs. I recommend Google Takeout and ImportExportTools.

These methods won't let you use Gmail filter functionality such as labeling messages, but at least you'll be able to locate the correct subset of messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.