beautypg.com

Google Message Security for Google Apps Administration Guide User Manual

Page 230

background image

230

Message Security for Google Apps Administration Guide

Match Any Email Address from a Specific Domain

Notes

[\w.+\-]

matches any word character (a-z, A-Z, 0-9, or

an underscore), a period, a plus sign, a percent sign, or
a hyphen. These are the only valid characters in a URL.
Note that the

\-

(which indicates a hyphen) must occur

last in the list of characters within the square brackets.

{0,25}

indicates that from 0 to 25 characters in the

preceding character set can occur after the text badmail.
Content Manager supports matching of up to 25
characters for each character set in a regular
expression.

The

\

before the dash and period “escapes” these

characters—that is, it indicates that the dash and period
are not a regex special characters themselves. Note that
there is no need to escape the period within the square
brackets.

Usage example

Match any email address from the domains yahoo.com,
hotmail.com, and gmail.com.

Regex example

(\W|^)[\w.+\-]{0,25}@(yahoo|hotmail|gmail)

\.com(\W|$)