A regular expression pattern is a series of characters that are matched against incoming character strings called as operators. You can use these patterns when you define expression criteria as regex.

Reserved Characters

Following characters are reserved as operators:

. ? + * | { } [ ] ( ) # @ & < > ~ " \

To use one of these characters, escape it with a preceding backslash or surround it with double quotes. For example:

Operator Example
\@ # renders as a literal '@'
\\ # renders as a literal '\'
"john@smith.com" # renders as 'john@smith.com'

Standard Operators

A standard operator consists of one or more reserved characters separated by ampersand (&) or tilde (~) characters. A standard operator is matched by attempting to match each of its component reserved characters against the entire input string.

Operator Description
.

Matches any character. For example:

ab. # matches 'aba', 'abb', 'abz', and so on.

?

Repeat the preceding character zero or one time. Often used to make the preceding character optional. For example:

abc? # matches 'ab' and 'abc'

+

Repeat the preceding character zero or more times. For example:

ab* # matches 'a', 'ab', 'abb', 'abbb', and so on.

{}

Minimum and maximum number of times the preceding character can repeat. For example:

a{2} # matches 'aa'

a{2,4} # matches 'aa', 'aaa', and 'aaaa'

a{2,} # matches 'a` repeated two or more times

|

OR operator. The match succeeds if the longest pattern on either the left side OR the right side matches. For example:

abc|xyz # matches 'abc' and 'xyz'

( … )

Forms a group. You can use a group to treat part of the expression as a single character. For example:

abc(def)? # matches 'abc' and 'abcdef' but not 'abcd'.

[ … ]

Match one of the characters in the brackets. For example:

[abc] # matches 'a', 'b', 'c'

Inside the brackets, - indicates a range unless - is the first character or escaped. For example:

[a-c] # matches 'a', 'b', or 'c'

[-abc] # '-' is the first character. Matches '-', 'a', 'b', or 'c'

[abc\-] # Escapes '-'. Matches 'a', 'b', 'c', or '-'

A ^ before a character in the brackets negates the character or range. For example:

[^abc] # matches any character except 'a', 'b', or 'c'

[^a-c] # matches any character except 'a', 'b', or 'c'

[^-abc] # matches any character except '-', 'a', 'b', or 'c'

[^abc\-] # matches any character except 'a', 'b', 'c', or '-'

~

You can use ~ to negate the shortest following pattern. For example:

a~bc # matches 'adc' and 'aec' but not 'abc'.

<>

You can use <> to match a numeric range. For example:

foo<1-100> # matches 'foo1', 'foo2' ... 'foo99', 'foo100'

foo<01-100> # matches 'foo01', 'foo02' ... 'foo99', 'foo100'.

&

Enables the & operator, which acts as an and operator. The match succeeds if patterns on both the left side and the right side matches. For example:

aaa.+&.+bbb # matches 'aaabbb'.

@

Enables the @ operator. You can use @ to match any entire string.

You can combine the @ operator with & and ~ operators to create an "everything except" the logic. For example:

@&~(abc.+) # matches everything except terms beginning with 'abc'.