Cisco Cisco Email Security Appliance C190 Guía Del Usuario
9-19
Cisco AsyncOS 9.5 for Email User Guide
Chapter 9 Using Message Filters to Enforce Email Policies
Message Filter Rules
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
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:
Case-sensitivity
Unless otherwise noted, regular expressions are case-sensitive. Thus, if your regular expression is
searching for
searching for
foo
, it does not match the pattern
FOO
or even
Foo
.
rcpt-to == "^goober@dev\\.null\\....$" (matching)
rcpt-to != "^goober@dev\\.null\\....$" (non-matching)