Regular Expressions

Regular expressions can be used as match-type operators for many types of policy rule tests. For example, a regular expression can be used to test the contents of a message's "Envelope To" field. Certain policy rule actions also support the use of regular expressions. For example, the "Deliver immediately for" action supports the use of a regular expression as a match-type for exceptions.

Policy Script Example:
if pmx_relay :re ".*\.com$" {

In this example, the match-type :re is used to perform a regular expression comparison. If the sender's address ends in the string ".com", the message is delivered and the filter stops evaluating the message.

The :re match-type is a PureMessage extension to the Sieve language. When regular expressions are used in PureMessage policy rule tests or actions, they are not prefixed or suffixed with slashes or braces. However, when manually editing the policy script on the command-line, you must "escape" backslashes, quotes and periods within regular expressions by preceding them with a backslash. For example, to search for the string "and\or", enter " and\\or " as the regular expression. The PureMessage Manager, a web-based interface for managing PureMessage, will automatically escape these characters for you.

For information about using regular expressions with the policy script via the PureMessage Manager, see "Policy Rule Tests" and "Policy Rule Actions" in the Policy section of the PureMessage Administrator's Reference. If you are manually editing the policy script, see the pmx-policy manpage (the documentation for the command-line interface to the PureMessage policy engine). See the "Regular Expressions Primer" in the PureMessage Administrator's Reference for general information about regular expressions.