Gmail – How to Search for Special Characters in Subject Line

gmailgmail-filtersgmail-search

Does anyone know if in Gmail you can search all messages that have an exclamation mark in the subject?

I would like to create a filter that adds a red ! label to the messages that have an exclamation mark in the subject. But searching for subject:! results in all messages. I've tried things like /!/, /\!/, (/\!/), "!", but all these searches just give me all messages, not just those with ! in the subject.

Best Answer

From the "About Gmail Search" documentation:

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

As you appear to have already discovered, and my quick tests appear to confirm, this seems to include the exclamation mark character.

I would assume that the regular expression Google are using to match search queries with possible results simply excludes all special characters and operates only on "word characters" (you can somewhat confirm this by the fact that searches for the underscore character, _, do work - the underscore is treated as a word character in a regular expression).