Cisco Cisco Email Security Appliance X1070 Mode D'Emploi
9-18
AsyncOS 9.1.2 for Cisco Email Security Appliances User Guide
Chapter 9 Using Message Filters to Enforce Email Policies
Message Filter Rules
Related Topics
•
•
•
•
•
•
•
Using Regular Expressions to Filter Messages
You can use filters to search for strings and patterns in non-ASCII encoded message content (both
headers and bodies). Specifically, the system supports regular expression (regex) searching for
non-ASCII character sets within:
headers and bodies). Specifically, the system supports regular expression (regex) searching for
non-ASCII character sets within:
•
Message headers
•
MIME attachment filename strings
•
Message body:
–
Bodies without MIME headers (i.e. traditional email)
–
Bodies with MIME headers indicating encoding but no MIME parts
–
Multi-part MIME messages with encoding indicated
–
All of the above without the encoding specified in a MIME header
You can use regular expressions (regexes) to match on any part of the message or body, including
matching attachments. The various attachment types include text, HTML, MS Word, Excel, and others.
Examples of character sets of interest include gb2312, HZ, EUC, JIS, Shift-JIS, Big5, and Unicode.
Message filter rules with regular expressions can be created through the content filter GUI, or using a
text editor to generate a file that is then imported into the system. For more information, see
matching attachments. The various attachment types include text, HTML, MS Word, Excel, and others.
Examples of character sets of interest include gb2312, HZ, EUC, JIS, Shift-JIS, Big5, and Unicode.
Message filter rules with regular expressions can be created through the content filter GUI, or using a
text editor to generate a file that is then imported into the system. For more information, see
and
.
Guidelines for Using Regular Expressions
It is important to begin a regular expression with a caret (
^
) and end it with a dollar sign (
$
) whenever
you want to exactly match a string and not a prefix.
Note
When matching an empty string, do not use
“”
as that actually matches all strings. Instead use
“^$”
. For
an example, see the second example in
.
It is also important to remember that if you want to match a literal period, you must use an escaped period
in the regular expression. For example, the regular expression
in the regular expression. For example, the regular expression
sun.com
matches the string
thegodsunocommando
, but the regular expression
^sun\.com$
only matched the string
sun.com.
Technically, the style of regular expressions used are Python re Module style regular expressions. For
a more detailed discussion of Python style regular expressions, consult the Python Regular Expression
HOWTO, accessible from
a more detailed discussion of Python style regular expressions, consult the Python Regular Expression
HOWTO, accessible from
:
http://www.python.org/doc/howto/