Regular Expressions

Regular expressions use operators and character strings to specify a set of character strings. They can be used when configuring business rules to allow more flexibility in the criteria used to route incidents. Regular expressions can also be used in mailbox filters and custom objects.

Note: Since the values in drop-down lists are fixed, using regular expressions to match items in a drop-down list (for example, Product or Category) is not supported. If you want to include an If condition for items in a drop-down list, use EQUALS or CONTAINS instead of a regular expression.

The first table below lists some of the regular expression operators that work with business rules and mailboxes. The second table lists examples of how regular expressions can be used.

Note: B2C Service accepts any regular expression using POSIX Extended syntax. POSIX Extended syntax does not support \n, \t, or \r as escaped special characters. Please check the POSIX extended syntax before authoring a regular expression.

Regular expressions begin and end with slash (/) delimiters, but they are not required when using regular expressions in business rules or report filters. However, slashes are used to separate multiple regular expressions in some configuration settings, such as EGW_AR_MODR_HEAD_FLTR.

Regular Expression Operators

Action Description

[ ]

Matches any character in the brackets.

[0-9]

Matches any number between 0 and 9.

[A-Z]

Matches any character A-Z or a-z.

[^]

Matches any characters NOT in the brackets. The first character in the brackets must be ^.

text1|text2

The pipe character acts as a Boolean OR, so text1 OR text2 results in a match.

Do not include a pipe at the beginning or end of a regular expression.

.

Matches any single character except a new line.

?

The preceding item is optional and matched at most once.

*

The preceding item is repeated as many times as necessary to match. Also matches if preceding item is not present.

+

The preceding item is matched one or more times.

{n}

The preceding item is matched exactly n times.

{n,}

The preceding item is matched n or more times.

{n,m}

The preceding item is matched at least n times, but not more than m times, and as few times as possible.

( )

Used to group elements of the regular expression, as in arithmetic.

\w

Any alphanumeric character.

^

Match if at start of line.

$

Match if at end of line.

\

Quote or escape a character that would otherwise be interpreted as a syntactic character. Characters that must be quoted are: + ? | ( ) { }

\<text\>

Match the string (case insensitive) only if it is surrounded on both sides by any non-word character (such as a space, dash, or a special character (!$%^.<>*|()?/\ : ;)). Note that alpha-numeric characters and underscores are considered word characters.

Regular Expressions Examples

This regular expression... matches...

^Example

“Example” at the beginning of a line

Example$

“Example” at the end of a line

^Example$

“Example” as the only word on the line

^...$

any line with exactly three characters

......-.....1

any reference number ending in “1”

t.e

tae, tbe, tce, t%e, tie, the, toe...

at*e

ae, ate, atte, attte, atttte...

at+e

ate, atte, attte

at?e

ae, ate

m[aeiou]t

mat, met, mit, mot, mut

cat|mat

cat, mat

lo{4}ng

loooong

lo{2,4}ng

loong, looong, loooong

ward | ward\. | ^ward

“ward” surrounded by spaces (this prevents “forward” or “backward” from matching), “ward” at the end of a sentence, and “ward” at the beginning of a line (no preceding space)

\<jump\>

Jump, jump, JuMp, etc. The regular expression does not match jumping, jumped, etc.