Is wildcard search possible in Gmail?
Not in general, no.
The Gmail search functionality works based on what I would describe as tokens. A token is any sequence of alphanumeric characters separated by a space or by other non-alphanumeric characters such as underscore, full stop (period), "@", dash, etc.. So in firstname.lastname@example.org there are 4 tokens: "peter", "ford23", "example" and "com".
Wildcards within tokens do not work. Wildcards outside of tokens are unnecessary and misleading.
Imagine you wish to find messages from email@example.com and tried these examples:
... would not work
... would work, but is misleading. It is no different from searching for "from:ford23".
If you thought that Gmail was checking for the "@" symbol immediately after "ford23", you could try this instead ...
... should not work, but does!
One example given in another answer is
... but again, Gmail is inadvertently misleading us. The dash and asterisk characters have no effect. (You can remove them and then remove the brackets too. It's the same as searching for "subject:jefferson".) It would return an email with subject "meeting with jefferson.jones".
... would not return an email with subject "jefferson-school"
... would not return an email with subject "jefferson-school"
There has been a suggestion that Perl regex can be used. I will not address that suggestion here, except to repeat that wildcards within tokens do not work (even using Perl syntax). And wildcards outside of tokens are unnecessary and misleading.
Disclaimer: For the sake of brevity I have used uncertainty-free language above. But I do not work for Google and I am not 100% sure of every claim in this answer. I do believe it is one of the best answers so far though. Google's own Gmail search operators help page doesn't mention wildcards.
I'm not sure how I'm supposed to interpret "
from:(ford23@*)would work, but is misleading" combined with "
from:(peter@*)should not work, but does". Are you basically saying that you have no idea why those are interpreted differently? Or are those interpreted the same? Or are you trying to suggest that numbers are treated differently from letters in this case? Mar 22, 2022 at 17:45
You can use Perl regex in both the find and filters if you wrap it in a forward slash.
Will match everything from the hp.com domain.
It gets complicated very quickly because you have to escape certain characters.
Here's one I use that matches multiple address and compresses several rules down to one:
from:(/(^(discship|info)\@netflix\.com$)|(\@(engage|email)\.xbox\.com$)/) Apply filter Media
That will label notification emails matching:
firstname.lastname@example.org email@example.com ANYTHING@engage.xbox.com ANYTHING@email.xbox.com
13Has anyone been able to get this to work? I'm using Google Apps, and it doesn't seem to work in either the filter or search. The only reason it does seem to work is because google discards symbols so your query
from:@hp.com. The reason
|works is because it acts as the
ORoperator. @Turtle: do you have any links to documentation of the feature? Jul 9, 2010 at 17:06
23Unfortunately, this doesn't work. Tested on both Gmail and Google Apps. Aug 29, 2010 at 3:50
5I am not able to get this to work either. Sep 23, 2012 at 22:21
11This is misleading. The only regex-like special characters that are respected by Gmail search are parentheses (for grouping) and the pipe ('OR' operator). @ToddProuty This example works because all the other symbols/punct serve as term separators, no different from spaces. Here is another example that works:
from:(/($(engage|email)\.\/xbox^com)/). Jan 1, 2015 at 19:22
5Does not work. This answer should be voted way down. I tried
^firstname.lastname@example.org$and it did not work. Other commenters are right about the reason. 'Tis a sad day. Mar 27, 2018 at 19:12
No, it is not possible. However, it depends on what you need it for. Gmail uses a very limited form of stemming based on whole words.
For example, let's see if I can retrieve emails from
from:phwd - works
from:pwhd.l - nope
from:phw - nope
So the closest you will get in this case is if the person was nice enough to cut their first name and last name by the period.
email@example.com will result in all of the above searches not working.
But say I was nice to fill out my contact information and have my display name as "phwd lastname" then I can at least retrieve it this way
from:"phwd" from:"phwd lastname"
It sucks but at least we have Gmail Ninjas.
2I wrote a detailed blog post about this, in case anyone wants more information. Oct 25, 2010 at 21:34
According to Berkeley Lab Commons:
Gmail search does not implement sub-string, partial word, wildcard, or regular expression searching.
Your only alternative is narrowing things down with Advanced Search or trying multiple, simultaneous options in the search box
2+1 thanks Ivo for that, sometimes I have some misspelled words in emails and was hoping for some solutions for this. I will leave the question open for another day in case someone come with a work around solution for this– kristofJul 8, 2010 at 16:59
How funny! I work at Berkeley Lab and I was an early adopter for the Berkeley Lab Google Apps implementation, and I was part of the discussion behind that FAQ. I have a slightly different take. See my answer below. Nov 11, 2013 at 16:55
The link now seems broken Aug 9, 2019 at 9:35
Wildcards are not officially supported in Gmail, even if they are supported in Google Search.
That said, I have been using wildcards to match hostnames and subject lines, and I have been doing this for 5+ years. However, since wildcards are an unsupported feature, the behaviour changes from time to time. Filters that once worked will stop working after Google changes Gmail. In addition, filters used with Gmail in Google Apps may work differently then filters in standard Gmail (outside of Google Apps).
The following examples work for me in Gmail for Google Apps.
For example, until Oct 2012 I was able to use the following search to match emails sent with the from line of "firstname.lastname@example.org" or "example@*.example.org" (where the latter was an email sent directly from email@example.com, for example).
from:(firstname.lastname@example.org OR example@*.example.org)
But in October 2012 this filter suddenly broke. But now I can use the following search with the same results:
Also, I can use a wildcard in the subject line. The following filter will match emails with a subject like:
[jefferson-school-pta] Important information from school principal:
2As per my answer, I believe that searching for subject:(jefferson-*) is the same as searching for subject:jefferson so any apparent success with wildcards is a red herring. Oct 8, 2014 at 1:42
Perhaps the algorithm has changed, but at the time of my email,
subject:jeffersonwould return different results. ``subject:jefferson` would not match
jefferson-school-pta. Oct 8, 2014 at 3:45
A bit easier, just write the following in the search box:
While this is correct for full pre-domain searches, it isn't a true wildcard meaning that
email@example.com't get found from a search like
from:(firstname.lastname@example.org). Oct 22, 2012 at 18:20
2As per my answer, I believe the * and @ do not have the intended (or any) effect. So this search will match against everything you expected it to, and potentially against some extra stuff. Oct 8, 2014 at 1:38
from:(*@aliexpress.com)matches an email from
email@example.com it does not really work nowadays Aug 9, 2021 at 22:46
I know it's not the most straightforward solution, but with Mozilla Thunderbird asterisk wildcard will work. For example, searching *top* will find anything containing partially or totally that string, for example, Stop or TopGun.
1this should be the accepted answer... it's a shame that still in 2022 Google didn't implemented wildcard search! Nov 29, 2022 at 14:04
No, it's not possible.
The search in Gmail does not allow substring search.
4Adding a link to backup your claim will help. Oct 23, 2012 at 0:45