Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is wildcard search possible in Gmail?

share|improve this question
1  
Could you please accept a different answer? The one that is currently accepted does not work. –  Senseful Dec 31 '10 at 19:13

8 Answers 8

up vote 5 down vote accepted

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 peter.ford23@example.com 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 peter.ford23@example.com and tried these examples:

from:(pete*)

... would not work

from:(ford23@*)

... 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 ...

from:(peter@*)

... should not work, but does!

`

One example given in another answer is

subject:(jefferson-*)

... 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".

subject:(jefferso*)

... would not return an email with subject "jefferson-school"

subject:(jefferso*-*)

... 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.

share|improve this answer

You can use Perl regex in both the find and filters if you wrap it in a forward slash.

from:(/(\@hp\.com$)/)

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:

discship@netflix.com
info@netflix.com
ANYTHING@engage.xbox.com
ANYTHING@email.xbox.com
share|improve this answer
4  
Has 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$)/) is becoming from:@hp.com. The reason | works is because it acts as the OR operator. @Turtle: do you have any links to documentation of the feature? –  Senseful Jul 9 '10 at 17:06
8  
Unfortunately, this doesn't work. Tested on both Gmail and Google Apps. –  Senseful Aug 29 '10 at 3:50
3  
I am not able to get this to work either. –  CoatedMoose Sep 23 '12 at 22:21
1  
@StefanLasiewski @Senseful @CoatedMoose I just tested this in both Gmail and Google Apps and it worked perfectly. Be sure to enter your search string in the main search field, not the labeled fields in the drop-down menu. For instance, I edited an existing filter, pasted in a regex search string, and clicked 'Continue.' The result was that the main search string was populated with a string beginning from:(from:(… If you are still unable to get this working, please post an example of a search string you tried. Getting the syntax right is very important. –  Todd Prouty Jan 30 '13 at 5:49
1  
I take it back. It does work. I just tried to search for 6 web & database hosts, and it works for me: from:(/\@web1|web2|webdev|db1|db2|dbdev\.example\.org$/) –  Stefan Lasiewski Jan 30 '13 at 20:19

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 phwd.lastname@gmail.com

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.

so phwdlastname@gmail.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 .

share|improve this answer
    
This page has some info. –  Lazer Jul 8 '10 at 19:21
1  
I wrote a detailed blog post about this, in case anyone wants more information. –  Senseful Oct 25 '10 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

share|improve this answer
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 –  kristof Jul 8 '10 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. –  Stefan Lasiewski Nov 11 '13 at 16:55

A bit easier, just write the following in the search box:

from: (*@mysite.com)

share|improve this answer
    
While this is correct for full pre-domain searches, it isn't a true wildcard meaning that wordpress@domain.com wouldn't get found from a search like from:(word*@domain.com). –  Dez Oct 22 '12 at 18:20
    
As 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. –  Peter Ford Oct 8 at 1:38

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 behavior 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 "example@example.org" or "example@*.example.org" (where the latter was email sent directly from root@host.example.org, for example).

from:(example@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:

from:example*example.org

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:

subject:(jefferson-*)
share|improve this answer
    
As 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. –  Peter Ford Oct 8 at 1:42
    
Perhaps the algorithm has changed, but at the time of my email, subject:(jefferson-*) and subject:jefferson would return different results. ``subject:jefferson` would not match jefferson-school-pta. –  Stefan Lasiewski Oct 8 at 3:45

No, it's not possible. The search in Gmail does not allow substring search.

share|improve this answer
2  
Adding a link to backup your claim will help. –  Dez Oct 23 '12 at 0:45

Here is Google's Advanced Search Tips page: http://mail.google.com/support/bin/answer.py?answer=8931&topic=41

In general there is no need for a wild card. You can simply search for 2 word or word parts with a space in between them and you will get any emails that contain the 2 words whether they are both found within the same word or not.

share|improve this answer
    
thanks for the link. I am not sure about the second part of your answer. Do you suggest that searching for 2 words: gen eral; would return emails that contain "genaral"? –  kristof Jul 8 '10 at 17:05
1  
maybe he meant phrase. I tried that and it did not work. –  phwd Jul 8 '10 at 17:10
    
@Kristof: Yes that is what I meant. –  RandomBen Jul 8 '10 at 17:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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