beautypg.com

Google Message Security for Google Apps Administration Guide User Manual

Page 223

background image

Content Manager

223

Group

(...)

Groups parts of an expression. Use grouping to apply a
quantifier to a group or to match a character class before or
after a group. For example, in the following expression:

\W(dog|cat|mouse)\W

the

\W

character class applies before and after each word in the

group. The expression would match things like dog+cat or
*dog*.

Quantifiers

{n}

Match the preceding expression exactly n times. For example:

[a-c]{2}

matches any letter from a to c only if two letters occur

in a row. Thus, the expression would match ab and ac but not
abc or aabbc.

{n,m}

Match the preceding expression a minimum of n times and a
maximum of m times. For example:

[a-c]{2,4}

matches any letter from a to c only if the letters

occur a minimum of 2 times and a maximum of 4 times in a row.
Thus, the expression would match ab and abc but not aabbc.

?

Indicates that the preceding character or expression can match
0 or 1 times. Equivalent to the range

{0,1}

. For example, the

following regular expression:

colou?r

matches either colour or color, because the

?

makes the letter

u optional.

Character

Description