Gmail Filters Wildcards: How to Use Them
In this article
Gmail filters do not support wildcards in the way a file search does. You cannot type an asterisk (*) into a filter's From, To, Subject or Has the words field and expect it to match any characters. Instead, Gmail uses its own search operators and treats partial words as prefix matches. So to achieve wildcard-like filtering, you build a filter using the correct operator or a partial address, not a star symbol. This guide shows exactly how to do that, what works, and what to do when a filter seems to ignore your pattern.
What You'll Need
- A Gmail account on desktop or mobile web (filter creation is not available in the Gmail mobile app; use a browser).
- Access to Gmail settings, which requires being signed in.
- A clear idea of the sender, subject pattern or keywords you want to match. Write them down before you start.
Step-by-Step
- Open Gmail in a desktop browser. The mobile app does not offer filter creation. On a phone or tablet, open the browser and go to mail.google.com, then request the desktop site if needed.
- Click the gear icon near the top right and choose See all settings. Labels can differ slightly by version and region, but the path is Settings > Filters and Blocked Addresses.
- Scroll to the Filters and Blocked Addresses tab. Click Create a new filter at the bottom of the list.
- Decide which field to use. For sender patterns, use the From field. For subject patterns, use Subject. For a mix of words anywhere, use Has the words. Do not type an asterisk; Gmail will treat it as a literal character.
- Use a partial address instead of a wildcard. If you want to catch every message from a domain, type
@example.comin the From field. That matches any sender at that domain. To match a name prefix, type the first part of the address, such asnewsletter, which will match addresses starting with that word. - Use Gmail search operators in the Has the words field. For example,
from:(@example.com)matches any sender at that domain.subject:(invoice OR receipt)matches either word in the subject.has:attachment filename:pdfmatches messages with a PDF attachment. These operators work in filters because Gmail evaluates them the same way as a search. - Combine conditions with OR and parentheses. Gmail search supports OR in uppercase. For example,
from:(@example.com OR @example.org)catches two domains. Without OR, Gmail treats multiple words as AND, meaning all must appear. - Click Continue to choose actions. Tick Apply the label and pick or create a label, or choose Skip the Inbox, Mark as read, Star it, Forward it or Delete it. Note that Delete permanently removes matching messages, so use it carefully.
- Choose whether to apply the filter to existing messages. Tick Also apply filter to matching conversations if you want past mail affected. This cannot be undone in bulk easily, so review the search preview first.
- Click Create filter. The filter appears in the list. Test it by sending yourself a message that should match and confirming the action happens.
Common Mistakes
- Typing an asterisk. Gmail treats
*as a literal character, not a wildcard. A filter forsupport*will not matchsupport@example.comunless the star is actually in the address. - Assuming partial words work everywhere. Gmail matches whole words in most fields. A filter for
invoicwill not matchinvoice. Use the full word or a search operator. - Forgetting OR is uppercase. Lowercase
oris treated as a word, not an operator. - Using the mobile app. The Gmail app has no filter creation screen. Use a browser.
- Applying to existing mail without checking. The preview search may match far more than expected. Review it before ticking the box.
Tips
- Use
from:(@domain.com)to catch every sender at a domain without listing each address. - Use
subject:(word1 OR word2)to match either word in a subject line. - Use
has:attachmentwithfilename:to target attachments by type or name. - Test a filter by sending yourself a matching message before relying on it for important mail.
- Keep filters narrow. A broad filter that skips the inbox can hide messages you need.
- Combine filters with labels rather than deletion so you can review matches later.
Troubleshooting
- The filter does not match anything. Check for an asterisk or a partial word. Replace it with a full word, a domain, or a search operator. Confirm the field is the right one; a From pattern will not match a subject.
- The filter matches too much. Add more conditions, such as a subject word or a domain, and use AND by listing multiple terms. Remove OR if you only need one pattern.
- The filter is not applied to old messages. Edit the filter and tick the option to apply to matching conversations. This only affects messages that match at the time you save.
- Messages still land in the inbox. Check the filter order. Gmail applies filters in the order listed, and a later filter can override an earlier one. Drag filters to reorder, or edit the conflicting one.
- You cannot find the filter option. Ensure you are in a desktop browser and signed in. The mobile app does not offer it.
- A filter stopped working after a change. Review the search terms. Gmail search syntax is strict about uppercase OR and parentheses. Rebuild the condition in the search box first to confirm it returns the right messages, then copy it into the filter.
Frequently Asked Questions
Can I use an asterisk as a wildcard in Gmail filters?
No. Gmail treats * as a literal character. Use a partial domain like @example.com or search operators instead.
How do I match every email from a domain?
Put @example.com in the From field, or use from:(@example.com) in the Has the words field.
Can I match multiple words in a subject?
Yes. Use subject:(invoice OR receipt) in the Has the words field. OR must be uppercase.
Do Gmail filters work on the mobile app?
You can view and manage existing filters in some versions, but creating a new filter requires a desktop browser.
Why does my filter not apply to old messages?
The option to apply to existing conversations must be ticked when you create or edit the filter. It does not run automatically later.
Can I use regular expressions in Gmail filters?
No. Gmail does not support regex in filters. Use search operators and exact words or domains.