beautypg.com

Google Message Security for Google Apps Administration Guide User Manual

Page 226

background image

226

Message Security for Google Apps Administration Guide

Match Whole Word Only

Note:

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

matches a specific word. Include the word you want to match in the rule value.

Match Exact Phrase Only

Usage example

Match the word hell. Don’t match the word hello, shell,
shellac, and so on.

Regex example

(\W|^)hell(\W|$)

Note

\W

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

underscore. It prevents the regex from matching letters
before or after the word.

Important:

When creating a regex to match whole words,

ensure that you include the

\W

character class, to help to

avoid capturing legitimate messages.

^

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.

Usage example

Match the phrase stock tips.

Regex
examples

1: (

\W|^)stock\stips(\W|$)

2:

(\W|^)stock\s{0,3}tips(\W|$)

3:

(\W|^)stock\s{0,3}tip(s){0,1}(\W|$)