How To Use Search Operators and Wildcards to Search GMail
Did you know you can use advanced search operators and wildcards to search Gmail? Did you know you can use a bunch of specific searches within Gmail to find something specific in a morass of mail? This tutorial shows you how to do it.
Gmail is one of the most popular freemail providers in the world. Not only does it offer reliable free email services, it also includes a suite of other Google tools, such as Drive, Sheets, Calendar, Photos, and a host of others. As you would expect from the company that created the world’s largest search engine, there is a lot more to Gmail than meets the eye.
Gmail offers the usual search functions, always visible at the top of the page, but it also offers a lot more. Using Regular Expressions, or RegEx for short, you can filter very specifically. For example, you could filter email from a particular address after a particular date, or between a set of dates. Once you get the hang of it, RegEx really is quite powerful.
Regular Expressions work in Gmail and Google Docs, so if you use both of them, this tutorial is going to be doubly useful. In fact, you actually need to use Google Docs to work with RegEx.
- Click this link to make a copy of the Gmail RegEx document in your own Google Docs. You will be prompted to make a copy of the file, select to copy it and you will see a Google Sheet like the image above. You should see a Gmail RegEx section in the center and a Gmail RegEx menu item appear.
- Select the Gmail RegEx menu item and select Initialize.
- Allow permissions for the file when prompted to enable it to work with your Gmail account.
Now that your Gmail RegEx feature is enabled, it is time to play.
The Gmail Label (Cell F3) refers directly to the labels you have configured in your Gmail account. If you decide to move a message from the inbox to another folder, you’re using labels; you can create new ones by clicking on the icon that looks like a file folder with an arrow to the right after you select an email. If you want to search your entire email account, leave the Label as Inbox. If you want to narrow the search, type in the exact label name in place of Inbox.
Add your search operator in Regular Expression (Cell F4), then select the Gmail RegEx menu and select Search Mailbox.
RegEx will search your Gmail account for any email containing whatever you put into Cell F4 and bring them back as a list in the Sheet. You can then select them directly from there.
Search operators and wildcards in Gmail
You don’t have to use RegEx if you don’t want to. You can use simpler search operators within Gmail to find what you’re looking for if you want. In the Inbox view, select the gray arrow next to the search button to expose the full search box. It is from here that you can use operators in Gmail.
You can keep your search operators simple or make them as complex as you like. Gmail works with three types of operators: Boolean, Gmail’s own, and Drive operators. This page on the Google website shows you what is what with search operators. Use one or many of the criteria within this search panel to find your email.
Let’s say you’re looking for an email from someone with an attachment you need. You know roughly when it was sent and by whom but cannot find it.
- You could try adding the sender’s email address in the From: box.
- You could try adding the approximate date it was sent by configuring the ‘Date within…’ entry at the bottom.
- Then hit the blue search button.
If that doesn’t work, close the search panel and go back to the basic search bar. You could type ‘is:unread’ in the search bar to pull only those emails you have yet to read.
If that doesn’t work, try ‘has:attachment’ as in this example we know the email had an attachment.
To save time, you could use a Boolean entry to combine the two into ‘is:unread AND has:attachment’. Remember, the broader the terms you use to search, the more emails you’re going to need to trawl through in order to find the specific one you’re looking for. The more you can narrow it down, the faster you can find what you’re looking for.
Wildcards are slightly different from regular search terms. They are denoted by an asterisk (*) and represent unknown terms in a search. You would add this at the end of a search term to cover random entries.
In the above example, you know that John sent you the email but you don’t know where he works or which email address he used to send it. You could use the search operator ‘John@*’ or ‘John*’ in the From search box to isolate it. The first search assumes the use of a first name and domain email address while the second covers first name and surname domain email address. You get the idea.