Certain special characters can be used to execute complex logic when performing searches on your message metadata (the Subject, To/CC/BCC, and From fields). Message bodies cannot be searched at this time because they are end-to-end encrypted and therefore not readable by the anyone but you.
Logical AND is implicit between any two search keywords (searching for ‘hello world’ means match ‘hello’ AND ‘world’). The other search operators are:
|Logical OR|||||hello | world||Matches text containing ‘hello’ or ‘world’|
|Logical NOT||! or –||hello !world||Matches text with ‘hello’ but not ‘world’|
|Grouping||()||(cat -dog) | (cat mouse)||Matches text with ‘cat’ and without ‘dog’ or ‘cat’ without ‘mouse’|
|Phrase||“”||“hello world”||Matches text with the keywords adjacent and ordered such as ‘hello world’ and ‘hello world and universe’ but not ‘hello brave new world’. You may use * as a word placeholder—”hello * * world” would match ‘hello brave new world’|
|Proximity||“”~N||“hello world”~10||Matches text containing ‘hello’ and ‘world’ with less than 10 words between them|
|Quorum||“”/N||“hello dear world”/2||Matches text with at least 2 of the 3 words, such as ‘hello dear’ and ‘hello world’
‘hello there’ would not match, but ‘hello there world’ would
|Order||“<<||hello << world||Matches text with ‘hello’ and ‘world’ only if they appear in the specified order
‘hello world’ would match but ‘world hello’ would not.
|Start||^||^hello||Matches text that begins with ‘hello’, such as ‘hello world’ but not ‘say hello’|
|End||$||world$||Matches text that ends with ‘world’, such as ‘hello world’ but not ‘world peace’|
|Wildcards||* and ?||h?llo w*d||The ? operator matches any single character, while * matches zero or more characters. The example search would match ‘hello world’ as well as ‘hallo word’|
In the past, ProtonMail used a simpler (and slower) search system that automatically added wildcards to both sides of the search query (a search for ‘hello’ was translated to ‘*hello*’). As seen above, wildcards attempt to fill-in-the-blank for search queries that are not 100% accurate. This was particularly convenient when searching in email addresses, because a search for ‘john’ would match ‘email@example.com’. In the new search system, you would have to search for ‘john*’ to find ‘firstname.lastname@example.org’. To avoid complexity and ease the transition to ProtonMail’s new system, we have built a feature called ‘Automatic Wildcards’ which reproduces a matching behavior similar to the old search system automatically for simple queries. So a search with Automatic Wildcards will convert ‘john smith’ to ‘*john* *smith*’ (words less than 3 characters long are not wildcarded). Queries using any of the special search operators described above are not wildcarded.
While Automatic Wildcards is convenient, it is also slower and provides less control than the regular search syntax. If you prefer, you can disable Automatic Wildcards for all searches in the Account tab of your ProtonMail Settings, or on a per-search basis by unchecking the “Don’t require exact match” checkbox in the Advanced Search dialog.