I use Gmail and I'm receiving lots of emails I want to filter. They all have in common that the subject is like these:

Some words - r1234 - Some more words
Some words - r987665 - Some more words
Some words - r01 - Some more words

So, all of them have something like - r... - in the subject...

Is there any way to filter all those messages?

  • 5
    Unfortunately, Gmail doesn't support regular expressions, but you could look into some of the other solutions that answer provides. – John Bensin Sep 23 '13 at 11:23
  • What if you search for "Some words - r" " - Some more words"? – MrWhite Sep 23 '13 at 14:10
  • @w3d I don't understand what you mean... – MikO Sep 24 '13 at 11:29
  • 1
    Ah, do "Some words" and "Some more words" vary each time? In that case my suggestion wouldn't work. I perhaps wrongly assumed that these two phrases were consistent among these emails? (Also, just realised that gmail doesn't seem to like searching for part words, so "wor" wouldn't find "word"!) – MrWhite Sep 24 '13 at 15:08

Googles help article 7190 lists the search operators you can use in Gmail. This article lists the AROUND keyword mentioned by RADA.

Currently, using the * (SHIFT 8) also works. I use it as *=AnyTextHere.

e.g. "Ticket* for user" find Ticket 1 for user and Ticket 2 for user and Ticket 1000 for user.


Short answer

Gmail doesn't include search features such wildcards or regular expressions.


Use the Gmail API, Google Apps Script or third party application that include search features like wildcards or regular expressions.


Search in Gmail - Gmail Help


Filtering "From" with:

*@someemail.com OR *@someothermail.com

Works for me.

  • Question is about doing it with regular expression on subjects. – Mateusz Konieczny Jun 27 '18 at 14:22

I haven't tried regex, but the current help doc specifies (with examples) the operators you can use to filter search results.



You can achieve this with google's AROUND keyword.

For example, I have a filter set up to delete emails with the subject line like "Your December 2018 Transaction History". To match any change in dates, I've set the subject to "Your AROUND Transaction History". It works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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