beautypg.com

Uses for regular expressions, Regular expressions syntax – Google Message Security for Google Apps Administration Guide User Manual

Page 219

background image

Content Manager

219

Uses for Regular Expressions

Using regular expressions, you can create content filters that can find:

Text patterns

Use this option to scan messages for patterns of letters, numbers, or a
combination of both. For example, you can create regular expressions that
match phone numbers, addresses, employee numbers, and account
numbers. Or, you can create one regular expression that can find many
different variations of a word, such as

viagra

,

vi@gra

,

v1agr@

, and so on.

Lists of words

Use this option to scan messages for specific categories of words, such as
profanity, financial terms, and legal terms.

Complete words

Use this option to create more specific filters. For example, you can create a
regular expression that matches the word

foot

but not

football

. In this case,

a regular expression can help to reduce the number of legitimate messages
that the filter captures.

Text with variable characters

Use this option to scan messages for patterns that contain specific text along
with text that varies. For example, you can create a single regular expression
that matches a URL in the pattern

www.[variable].com

, such as

www.abc1.com

,

www.abc2.com

, and

www.abc3.com

.

Regular Expressions Syntax

To create a regular expression, you must use specific syntax—that is, special
characters and construction rules. For example, the following is a simple regular
expression that matches any 10-digit telephone number, in the pattern

nnn-nnn-

nnnn

:

\d{3}-\d{3}-\d{4}

Note:

Content Manager supports only POSIX ERE syntax and equivalent

shorthand characters. For more information, see “Content Manager Support for
Regular Expressions” on page 224
.

The following table describes some of the most common special characters for
use in regular expressions. These characters are categorized as follows: