Cisco Cisco Expressway Maintenance Manual
Regular expressions
Regular expressions can be used in conjunction with a number of Expressway features such as alias transformations,
zone transformations, CPL policy and ENUM. The Expressway uses POSIX format regular expression syntax. The
table below provides a list of commonly used special characters in regular expression syntax. This is only a subset of
the full range of expressions available. For a detailed description of regular expression syntax see the publication
Regular Expression Pocket Reference.
zone transformations, CPL policy and ENUM. The Expressway uses POSIX format regular expression syntax. The
table below provides a list of commonly used special characters in regular expression syntax. This is only a subset of
the full range of expressions available. For a detailed description of regular expression syntax see the publication
Regular Expression Pocket Reference.
Character Description
Example
.
Matches any single character.
\d
Matches any decimal digit, i.e. 0-9.
*
Matches 0 or more repetitions of the
previous character or expression.
previous character or expression.
.*
matches against any sequence of characters
+
Matches 1 or more repetitions of the
previous character or expression.
previous character or expression.
?
Matches 0 or 1 repetitions of the previous
character or expression.
character or expression.
9?123
matches against 9123 and 123
{n}
Matches n repetitions of the previous
character or expression
character or expression
\d{3}
matches 3 digits
{n,m}
Matches n to m repetitions of the previous
character or expression
character or expression
\d{3,5}
matches 3, 4 or 5 digits
[...]
Matches a set of specified characters. Each
character in the set can be specified
individually, or a range can be specified by
giving the first character in the range
followed by the - character and then the last
character in the range.
character in the set can be specified
individually, or a range can be specified by
giving the first character in the range
followed by the - character and then the last
character in the range.
You cannot use special characters within
the [] - they will be taken literally.
the [] - they will be taken literally.
[a-z]
matches any alphabetical character
[0-9#*]
matches against any single E.164 character -
the E.164 character set is made up of the digits 0-9 plus
the hash key (#) and the asterisk key (*)
the hash key (#) and the asterisk key (*)
[^...]
Matches anything except the set of
specified characters. Each character in the
set can be specified individually, or a range
can be specified by giving the first character
in the range followed by the - character and
then the last character in the range.
specified characters. Each character in the
set can be specified individually, or a range
can be specified by giving the first character
in the range followed by the - character and
then the last character in the range.
You cannot use special characters within
the [] - they will be taken literally.
the [] - they will be taken literally.
[^a-z]
matches any non-alphabetical character
[^0-9#*]
matches anything other than the digits 0-9, the
hash key (#) and the asterisk key (*)
(...)
Groups a set of matching characters
together. Groups can then be referenced in
order using the characters \1, \2, etc. as
part of a replace string.
together. Groups can then be referenced in
order using the characters \1, \2, etc. as
part of a replace string.
A regular expression can be constructed to transform a
URI containing a user’s full name to a URI based on their
initials. The regular expression
URI containing a user’s full name to a URI based on their
initials. The regular expression
(.).*_(.).*
(@example.com)
would match against the user
john_
smith@example.com
and with a replace string of
\1\2\3
would transform it to
js@example.com
|
Matches against one expression or an
alternate expression.
alternate expression.
.*@example.(net|com)
matches against any URI for the
domain
example.com
or the domain
example.net
276
Cisco Expressway Administrator Guide
Reference Material