Numbers must be positive integers in base 10. When a number is immediately followed by the letter K, it is multiplied by 1024 (for kilobytes). When it is immediately followed by the letter M, it is multiplied by 1024*1024 (for megabytes), and when followed by G, it is multiplied by 1024*1024*1024 (for gigabytes). The letter after the number can be uppercase or lowercase.
Strings must be enclosed between double quotes or single quotes.
If the first character is a single quote, double quotes can be used in the string as normal characters (example: 'Result of "command"'
). Conversely, if the first character is a double quote, single quotes can be used normally inside the string (example: "Scarlett O'Hara"
)
A string may also contain the enclosing character itself. In this case, the entire string must be started by a backslash before the single or double quote, and each non-terminating occurrence of the enclosing character inside the string must be preceded by a backslash. In addition, to represent a backslash itself in such a string, the backslash character must be doubled.
For example, a regexp that matches single or double quotes could be written as:
"[\"\']"
Table XI.1. Operators for filter expressions
Operator | Example | Description |
---|---|---|
! | !condition("urgent") | Logical inverse of the operand. Equivalent to not . |
= | header("Precedence")="bulk" | Test for the case insensitive equality of two strings. ("A"="a" is true). |
isnot | to isnot "me@example.com" | This is the logical inverse of the is operator. |
eq | header("Precedence") eq "bulk" | Test for the exact equality of two strings (case sensitive). |
ne | header("Precedence") ne "bulk" | This is the logical inverse of the eq operator (case-sensitive equality of strings). |
contain contains | header("from") contains "@example.net" | True if the left operand contains the right operand, case insensitive. |
!= | now("month")!=12 | Test for the inequality of two numeric values. |
== | date("weekday")==1 | Test for the equality of two numeric values. |
< | age("days")>=2 | Compare two numeric values, testing for lower, lower or equal, greater, greater or equal. |
=~ | header("subject") =~ "^\[URGENT\]" | True if the left operand matches the regular expression in the right operand, case insensitive. |
!~ | header("subject") !~ "^\[URGENT\]" | True if the left operand does not match the regular expression in the right operand, case insensitive. |
regmatches | header("subject") regmatches "^\[URGENT\]" | True is the left operand against the regular expression matches the right operand, case sensitive. |
and | from is "a@example.com" AND to is "b@example.com" | True if both the left operand and right operand evaluate to true. |
or | from is "a@example.com" OR from is "b@example.com" | True if either of the left operand or right operand evaluate to true. |
Arbitrarily complex expressions can be written by combining conditions and operators and nested parentheses. Example:
(pg_gen OR pg_interf) AND NOT (header("From") contains "@example.org")
All the expressions that have at least one action connected to them are evaluated, unless the "Stop filters" action gets triggered.