I've got a Gmail email filter rule set up to prevent email from various senders from going into spam.  Here's a simplified version of the rule:

Do this: Never send it to Spam

As you can see, to keep it short and more generalised (not too generalised so far), I have not listed entire email addresses.

So far the above rule seems to be working for everything listed except "mybank", which still allows emails from "office@mybanksavings.co.nz" to go into spam.

Is this because the filter doesn't match on partial "words" (alphanumeric strings?), or what?

I had a quick look here, but it didn't seem to go into sufficient detail:
So if you know of a link to support whatever you say, that could also help.

  • You could try using wildcards. *@mybank*
    – DrZoo
    Oct 1 '15 at 0:52
  • I've just tested that kind of thing and it seems to be not working, DrZoo, but thanks for trying. Well, it "works" if, for example, "mybank" appears as a separate word in the display name (e.g. MyBank Savings <info@mybanksavings.co.nz>), but in that scenario, so does "@mybank*", "*mybank*", "mybank*" and just "mybank". So, it looks as if the "*" wildcard is being ignored in those cases.
    – Terry
    Oct 1 '15 at 3:41
  • You could make a separate filter for the bank thing.
    – DrZoo
    Oct 1 '15 at 3:45
  • 1
    So I guess the only point in starting with "@" is to prevent matching other domain prefixes (e.g. test@amybanksavings.co.nz, note the leading "a"). It also looks as if emails from info@mybanksavings.co.nz will be matched by these filters: "mybanksavings" & "mybanksavings.co", but not "mybanksavings.c" or "mybanksavings.c*”, so again it seems to be about complete "words" (i.e. alphanumeric strings up to an an "@" or "." or the end of the string).
    – Terry
    Oct 1 '15 at 3:52
  • 1
    to match domains but not any higher domains AFTER... ie: match @domain.com but NOT @domain.com.au... try actually enclosing in quotes, eg: from:"@domain.com" - since it parses on WHOLE WORDS, and you've specifically said you only want the characters in quotes, it shouldn't include the other results. It might also help to possibly add -from:"@domain.com." (note the trailing dot) - but not likely, as it usually ignores special chars. Jul 10 '21 at 13:49

Gmail search doesn't support wildcards, partial words, or regular expressions. By extension, then, neither do Gmail filters. (Some information from Google Support.)

@example.com will work because @ is a word separator. But @example will match @example.com but not @examplexyz.

Some related questions here:

  • 1
    Well said, AI E. That seems to go along with the comments I made above, and it's good to have those links. Your Google Support link helped me to find Advanced Operators (support.google.com/mail/answer/7190), which is a page I have seen before, but I'm surprised they don't mention the "|" (alternative to the "OR") operator. I assume Google have tried to keep their search facility as simple as possible, because not all users are programmers, and as a result, there are limits to what can be searched for / filtered on.
    – Terry
    Oct 1 '15 at 21:40
  • Very often Google Support lags changes made to the apps, sometimes by several months.
    – ale
    Oct 1 '15 at 21:41
  • Are you talking about the lack of documentation for the "|" operator?
    – Terry
    Oct 2 '15 at 0:56
  • No, just in general that sometimes there's features that aren't fully documented.
    – ale
    Oct 2 '15 at 1:18
  • 1
    @Blairg23 — Where is this documented, please? I have been trying to get regex to work in Gmail, with no success whatsoever. Unless Google has removed the functionality since you posted :( Aug 17 '20 at 18:52

According to this article from Zapier, you can use syntax as shown below (more examples in the article):

enter image description here

  • nope, it does not work. and the source document does not mention about regular expression. brackets here are only used for grouping, e.g. -(contact@zapier.com OR support@zapier.com) Oct 28 '19 at 10:48
  • the question is about partial word, your syntax works for filtering (and I provided the example), but it does not answer the question. As I experimented, the syntax does not work for partial matching. Oct 29 '19 at 15:32
  • Ah, I misread that to mean "partial sentences" or "sentences with only some of the words"
    – Blairg23
    Oct 29 '19 at 17:23

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.