Rules using regular expressions

Normally, rules for processing email look for text that "contains", "starts with", or is "equal to" a certain value. We do also support more complicated matching using globs or regular expressions, though. These can be good options for more technical users looking to create complex rules.

Glob patterns

In a glob pattern, you can use * to match any number of characters, and ? to match a single character. The glob match is "anchored" at the beginning and end of the searched text, so *word* is equivalent to "contains word", and word is equivalent to "is word".

Regular expressions

A regular expression is a powerful system for testing a value for a match, going well beyond what a glob match supports.

This is a complex system, and the scope of regular expressions is too broad to be covered here. If you'd like to learn about regular expressions, there are many good resources available online.

Note that POSIX EREs are supported, but NOT PCREs.


Be careful using does not match glob and does not match regular expression conditions. It's easy to accidentally filter all your mail away if you haven't considered all the angles. Remember that only this rule is negated. If you attempt to build a whitelist with multiple discard rules, it's easy to end up discarding all mail. For example, suppose you had the following two discard rules:

  • "The sender's email does not match glob *myfriend*.
  • "The sender's email does not match glob *myotherfriend*.

All mail would be rejected. The first rule will discard mail from "", and the second rule will discard mail from "". That's probably not what you want!

Note that the * at either end are important if you just want to test that some text doesn't occur anywhere in the specified headers.

Was this article helpful?
18 out of 67 found this helpful