I'm trying to create a search filter when I receive automated emails .

The emails that I want to filter always contain the following format:

Gitlab | foo | bar | herp a derp

How can I create a filter for emails that meets the following requirements?


  • "Gitlab |"

But does not match emails with the subject

  • "gitlab"
  • "Gitlab"

What I have tried

subject:+"Gitlab |" 
subject:"Gitlab |"
subject:"Gitlab \|"
subject:("Gitlab |")
subject:(Gitlab |)

Yet I find that Gmail matches any email that contains the word "gitlab" in the subject, regardless if there is a "|" present.

How can I filter just emails with "Gitlab |"?


2 Answers 2


Unfortunately, you probably can't do what you want.

From About Gmail Search

Gmail doesn't recognize special search characters like square brackets, parentheses, currency symbols, the ampersand, the pound sign, and asterisks

You'll need to find some other unique information about the messages you want to filter. (Advanced Search Operators)

  • Recently I tried to create a filter with special characters and when I tried using a backslash (\) to escape the characters the warning about special characters wasn't shown. I have yet to determine if this works though, with or without the backslashes the emails that match are the same.
    – 2rs2ts
    Dec 28, 2015 at 15:10
  • 3
    @2rs2ts No, backslashing an exclamation mark doesn't help to restrict the search. Unfortunately. I've just tested this with subject:\! vs subject:!. Sep 15, 2016 at 6:41

CloudBerry backup reports show the status of their backup jobs with a smiley or frown face ":)" or ":("

Searching Gmail with + appears to allow you to search special characters.

According to the advanced Gmail search operators that @ale linked to earlier

Results that match a word exactly | +

                               | Example: +unicorn

Searching for 'Has the words 'CloudBerry Backup report :)' results in a search for 'CloudBerry Backup report :' with the closing parentheses removed.

When using 'CloudBerry Backup report +:)' the parentheses remains and messages accurately show in search results.

  • 4
    This did not work for me with #. For example, searching for +#house and #house returned the same results: everything with the word house, instead of just #house.
    – Derek
    Sep 13, 2019 at 20:38

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.