8

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:

Matches:
from:(abc.org.nz|def.nz|westpac|mailman|ird.govt|mybank|contact)
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:
  https://support.google.com/mail/answer/6579?hl=en
So if you know of a link to support whatever you say, that could also help.

migrated from superuser.com Oct 1 '15 at 12:52

This question came from our site for computer enthusiasts and power users.

  • 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
  • No need. It looks as if I simply need to include the a whole "word", in my current match, e.g. "mybanksavings", instead of just "mybank". – Terry Oct 1 '15 at 3:51
  • 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
7

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
  • In this case, I think the "|" has been around for at least a year, and I still don't see it on that Advanced Operators webpage, and I think that should be the place for it. – Terry Oct 2 '15 at 1:32
1

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

enter image description here

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.