In the SBC Edge, Regular Expressions can be used for phone number matching and transformation. Use of Regular Expressions for phone number transformation is supported in the Transformation Tables .

Examples of Regular Expressions for phone number matching and transformation are shown below. For more information about Regular Expression syntax, see Understanding Regular Expressions.

Examples of Phone Number Matching and Transformation using Regular Expressions

Phone number transformation is the process of matching phone number patterns and transforming them to a single standard format.
In the context of Enterprise Voice, the single standard format could be the local numbering plan, the E.164 numbering scheme, as well as a SIP URI.

The following table illustrates use of Regular Expressions for matching phone number patterns and phone number transformations:

Rule Name

Description

Input Pattern

Output Pattern

Result

4-digit Extension

Transforms 4-digit extensions

(\d{4})
+1425555\1

1234 is transformed to +14255551234

5-digit Extension

Transforms 5-digit extensions

8(\d{4})
+1425558\1

81234 is transformed to +14255581234

7-digit calling Fremont

Transforms 7-digit numbers to Fremont local number

(\d{7})
+1510\1

5551212 is transformed to +15105551212

7-digit calling Dallas

Transforms 7-digit numbers to Dallas local number

(\d{7})
+1972\1

5551212 is transformed to +19725551212

10-digit calling US

Transforms 10-digit numbers in US

(\d{10})
+1\1

5105551212 is transformed to +15105551212

Long Distance (LD) Calling US

Transforms numbers with LD prefix in US

1(\d{10})
+1\1

12145551212 is transformed to +12145551212

International Calling

Transforms numbers with US international prefix

011(\d*)
+\1

011914412345678 is transformed to +914412345678

Fremont Operator

Transforms 0 to Fremont Operator

0
+15105551212

0 is transformed to +15105551212

Fremont Site Prefix

Transforms numbers with on-net prefix (6) and Fremont site code (222)

6222(\d{4})
+1510555\1

62221234 is transformed to +15105551234

New York Site Prefix

Transforms numbers with on-net prefix (6) and New York site code (333)

6333(\d{4})
+1202555\1

63331234 is transformed to +12025551234

Dallas Site Prefix

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

6444(\d{4})
+1972555\1

64441234 is transformed to +19725551234

URI to E.164 format

Transforms URI with on-net prefix (+999) to E.164 format

\+999(.*)@.*
0119144\1

+99912345678@net.com is transformed to 011914412345678

The use of caret symbol (^) for beginning of a number-matching pattern and the dollar sign ($) for the end of the pattern is implicit. The regular expression rule will work with or without them.

Detailed Examples

Example 1: Using Regular Expression for Route Match

  1. Select Using Regular Expression option.
  2. Match Rule:

    (.*)@net\.com
  3. Transformation :

    \1

    In this example, the input text john.doe@net.com matches the Match Rule and the output will be "john.doe". The Input text john.doe@invalid.comdoes not match.

    Expression Input

    Expression Output

    john.doe@net.com

    john.doe

    jane_doe@net.com

    jane_doe

    jdoe@net.com

    jdoe

    john.doe@invalid.com

    expression does not match: no output

Example 2: Local calls transformed to National numbering plan

  1. Select Using Regular Expression option.
  2. Match Rule:

    (\d{7})
  3. Transformation:

    1510\1

    In this example, any 7 digit number as input matches the Match Rule and the output will be the same 7-digit number prefixed with 1510.

    Expression Input

    Expression Output

    8889999

    15108889999

    4441234

    15104441234

Example 3: 10-digit long distance (LD) calls transformed for 11-digit dialing

  1. Select Using Regular Expression option.
  2. Match Rule:

    (\d{10})
  3. Transformation:

    1\1

    In this example, any 10-digit number as input matches the Match Rule and the output will be the same 7-digit number prefixed with 1.

    Expression Input

    Expression Output

    5107779999

    15107779999

Example 4: Stripping +-sign from the number (when terminating to some ISDN providers)

  1. Select Using Regular Expression option.
  2. Match Rule:

    \+(.*)
  3. Transformation:

    \1

    In this example, any destination number prefixed with a +-sign (plus-sign) as input matches the Match Rule and the output will be the same number without the +-sign.

    Expression Input

    Expression Output

    +914412345678

    914412345678

Example 5: Replacing "011" (international prefix) with +-sign

  1. Select Using Regular Expression option.
  2. Match Rule:

    011(.*)
  3. Transformation:

    +\1

    In this example, any destination number prefixed with a +-sign (plus-sign) as input matches the Match Rule and the output will be the same number without the +-sign.

    Expression Input

    Expression Output

    011914412345678

    +914412345678

Example 6: Transforming only URI's that start with "+999" and have a ".com" extension to E.164 format

  1. Select Using Regular Expression option.
  2. Match Rule:

    \+999(.*)@(.*)\.com
  3. Transformation:

    0119144\1

    In this example, any destination URI +99912345678@net.com matches the pattern +999, followed any character set (.*), followed by the @-sign, followed any character set (.*), followed by and ending with \.com, the first character set is preserved and 0119144 is prefixed to it resulting in 011914412345678.

Expression Input

Expression Output

+99912345678@net.com

011914412345678