Rules using regular expressions

Normally, rules for processing email look for text that is "equal to" or "contains" or "starts with" a certain value. However, we also support more complicated matching using globs or regular expressions.

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.

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 to be found on the online.

Note that POSIX EREs are supported, but NOT PCREs.

Negation

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:

All mail would be rejected. The first rule will discard mail from "myotherfriend@example.com", and the second rule will discard mail from "myfriend@example.com". 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.