Cisco Cisco Email Security Appliance X1050 Guía Del Usuario
9-19
User Guide for AsyncOS 10.0 for Cisco Email Security Appliances
Chapter 9 Using Message Filters to Enforce Email Policies
Message Filter Rules
•
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/
Regular Expression and Non-ASCII Character Sets
In some languages, the concepts of a word or word boundary, or case do not exist.
Complex regular expressions that depend on concepts like what is or is not a character that would
compose a word (represented as “
compose a word (represented as “
\w
” in regex syntax) cause problems when the locale is unknown or if
the encoding is not known for certain.
n Tests
Regular expressions can be tested for matching using the sequence
==
and for non-matching using the
sequence
!=
. For example:
rcpt-to == "^goober@dev\\.null\\....$" (matching)