Examples of Rules Using Regular Expressions

Example 1: Matching a list of options

Example Goal: Categorize as TechSupport all messages whose subjects contain help, support, or customer support, regardless of case.

Example Rule:

IF incoming subject matches the regular expression '/help|support|customer support/i'

THEN categorize as: TechSupport

Example 2: Matching part of the e-mail address

Example Goal: Route to queue1 all messages whose sender's address contains "mycompany.com".

Example Rule:

IF senders address matches the regular expression '/.*mycompany\.com/i'
THEN route to 'queue1'

 

NOTE: In this example, the dot (.) represents a variable character, and the asterisk (*) indicates that any number of variable characters can precede the portion of the e-mail address to be matched.

Example 3: Routing based on meaningful numbers.

Example Goal: Route all messages containing credit card numbers to the Accounting queue. In other words, if the message contains a 16-digit number in 4-digit groups with optional dashes or spaces, assume that the number is a credit card number and route the message appropriately.

Example Rule:

IF incoming body matches the regular expression '/([0-9] {4} ([- ])*){3} [0-9] {4}/x'
THEN route to 'Accounting'

[0-9] {4} means 4 digits between 0 and 9.

([- ])* means any number of optional dashes or spaces.

([0-9] {4} ([- ])*){3} specifies 3 sets of 4 digits with optional dashes or spaces afterward.


Learn about rules and rule groups.

How do I use a regular expression in a rule?

How do I create a rule?

How do I edit rules?

How do I delete a rule?

How do I re-order rules?