Phone Number Normalization Rule Regular Expressions

The pattern-matching notation of regular expressions makes it possible to quickly parse large amounts of text to find specific character patterns; to extract, edit, replace, or delete text substrings; or, to add the extracted strings to a collection in order to generate a report. You use .NET regular expressions to specify the phone pattern and the translation pattern as follows:

  • Phone pattern regular expression. This consists of designators and variables that represent specific sets of numbers. For example, the phone pattern regular expression of ^9(\d{7})$ describes phone numbers that consist of the number 9 followed by any seven digits.

  • Translation pattern regular expression. This consists of the + symbol, numbers, and the $ symbol. The $ symbol captures the items of the phone pattern regular expression that are included inside the parenthesis. The number following the $ symbol must be less than or equal to the total number of captures specified by the phone pattern regular expression.

    For example, the translation pattern regular expression of +1425$1 describes a translation that adds a prefix of +1425 to the captures (the phone pattern items in parenthesis). If the phone pattern regular express is ^9(\d{3})(\d{4})$ (containing two captures), the number following the $ sign can only be 1 or 2.

The following table shows sample normalization rules and the corresponding values for the rule name, description, phone pattern, and translation pattern.

Rule Name

Description

Phone Pattern

Translation Pattern

Example

4digitExtension

Translates 4-digit extensions

^(\d{4})$

+1425555$1

1234 is translated to +14255551234

5digitExtension

Translates 5-digit extensions

^8(\d{4})$

+1425558$1

81234 is translated to +14255581234

7digitcallingRedmond

Translates 7-digit numbers to Redmond local number

^(\d{7})$

+1425$1

5551212 is translated to +14255551212

7digitcallingDallas

Translates 7-digit numbers to Dallas local number

^(\d{7})$

+1972$1

5551212 is translated to +19725551212

10digitcallingUS

Translates 10-digit numbers in US

^(\d{10})$

+1$1

2065551212 is translated to +12065551212

LDCallingUS

Translates numbers with LD prefix in US

^1(\d{10})$

+1$1

12145551212 is translated to +12145551212

IntlCallingUS

Translates numbers with international prefix in US

^011(\d*)$

+$1

011914412345678 is translated to +914412345678

RedmondOperator

Translates 0 to Redmond Operator

^0$

+14255551212

0 is translated to +14255551212

RedmondSitePrefix

Translates numbers with on-net prefix (6) and Redmond site code (222)

^6222(\d{4})$

+1425555$1

62221234 is translated to +14255551234

NYSitePrefix

Translates numbers with on-net prefix (6) and NY site code (333)

^6333(\d{4})$

+1202555$1

63331234 is translated to +12025551234

DallasSitePrefix

Translates numbers with on-net prefix (6) and Dallas site code (444)

^6444(\d{4})$

+1972555$1

64441234 is translated to +19725551234

Learn More Online

Click to expand or collapse

For details about specifying a phone number normalization rule, how to use .NET regular expressions to create these rules, and additional sample rules, see the Enterprise Voice documentation in the Office Communications Server Technical Library.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×