beautypg.com

Google Message Security for Google Apps Administration Guide User Manual

Page 228

background image

228

Message Security for Google Apps Administration Guide

Match Word or Phrase in a List

Note:

You can also use the rule filter “matches any word in” to create a rule that

matches specific words. The rule filter “matches any word” does not, however,
match phrases. Include the words you want to match in the rule value.

Usage example

Match any word or phrase in the following list:

baloney

darn

drat

fooey

gosh darnit

heck

Regex example

(\W|^)(baloney|darn|drat|fooey|gosh\sdarnit|heck)(\W

|$)

Notes

(...)

groups all the words, such that the

\W

character

class applies to all of the words within the parenthesis.

\W

matches any character that’s not a letter, digit, or

underscore. It prevents the regex from matching
characters before or after the words or phrases in the
list.

^

matches the start of a new line. Allows the regex to

match the word if it appears at the beginning of a line,
with no characters before it.

$

matches the end of a line. Allows the regex to match

the word if it appears at the the end of a line, with no
characters after it

|

indicates an “or,” so the regex matches any one of the

words in the list.

\s

matches a space character. Use this character to

separate words in a phrase.