27.11.2012 Views

IronPort - advanced configuration guide

IronPort - advanced configuration guide

IronPort - advanced configuration guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6-16<br />

Table 6-3 Regular Expression in Rules<br />

Using Regular Expressions to Filter Messages<br />

Cisco <strong>IronPort</strong> AsyncOS 7.6 for Email Advanced Configuration Guide<br />

Chapter 6 Using Message Filters to Enforce Email Policies<br />

Case-insensitivity ((?i)) The token (?i) that indicates the rest of the regular expression should<br />

be treated in case-insensitive mode. Placing this token at the beginning<br />

of a case-sensitive regular expression results in a completely<br />

insensitive match.<br />

Number of repetitions<br />

{min,max}<br />

You can use filters to search for strings and patterns in non-ASCII encoded message content (both<br />

headers and bodies). Specifically, the system supports regular expression (regex) searching for<br />

non-ASCII character sets within:<br />

Message headers<br />

MIME attachment filename strings<br />

Message body:<br />

– Bodies without MIME headers (i.e. traditional email)<br />

– Bodies with MIME headers indicating encoding but no MIME parts<br />

– Multi-part MIME messages with encoding indicated<br />

– All of the above without the encoding specified in a MIME header<br />

You can use regular expressions (regexes) to match on any part of the message or body, including<br />

matching attachments. The various attachment types include text, HTML, MS Word, Excel, and others.<br />

Examples of character sets of interest include gb2312, HZ, EUC, JIS, Shift-JIS, Big5, and Unicode.<br />

Message filter rules with regular expressions can be created through the content filter GUI (see “Email<br />

Security Manager” in the Cisco <strong>IronPort</strong> AsyncOS for Email Configuration Guide), or using a text editor<br />

to generate a file that is then imported into the system. For more information, see Using the CLI to<br />

Manage Message Filters, page 6-75 and Modifying Scanning Parameters, page 6-84.<br />

Guidelines for Using Regular Expressions<br />

For example, the regular expression “(?i)viagra” matches Viagra,<br />

vIaGrA, and VIAGRA.<br />

The regular expression notation that indicates the number of repetitions<br />

of the previous token is supported.<br />

For example, the expression “fo{2,3}” matches foo and fooo but not<br />

fo or fofo.<br />

This statement: if(header('To') == "^.{500,}")looks for a “To”<br />

header that has 500 or more characters in it.<br />

Or (|) Alternation, or the “or” operator. If A and B are regular expressions, the<br />

expression “A|B” will match any string that matches either “A” or “B.”<br />

For example, the expression “foo|bar” will match either foo or bar,<br />

but not foobar.<br />

It is important to begin a regular expression with a caret (^) and end it with a dollar sign ($) whenever<br />

you want to exactly match a string and not a prefix.<br />

OL-25137-01

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!