Examples of regular expression match and replace for external trunk number transformation


Note: These examples apply to the Transform outbound addresses with regular expressions article.

regex match ^(sip[s]?:|tel:)(\+)(.*)

regex format $1$3

For example, this regex changes  +17165551212  to  17165551212.


  • The regex match goes into the Match Regular Expression fields for both the Calling Address Transformation and the Called Address Transformation.
  • The regex format goes into the Format Regular Expression fields for both the Calling Address Transformation and the Called Address Transformation.

US Country Code 1

Trunk Code 1

Exit Code 011


For the U.S. numbers, the regex to remove the + and add the trunk code 1.

Regex match ^(sip[s]?:|tel:)(\+)(.*)

Regex format $1\x31$3

For example, this regex changes  +17165551212  to  117165551212.


For the international numbers, the regex to remove the + and add exit code 011

Regex match ^(sip[s]?:|tel:)(\+)(.*)

Regex format $1\x30\x31\x31$3

For example, this regex changes +443035551212   to  011443035551212.


  • The regex matches go into the Match Regular Expression fields for both the Calling Address Transformation and the Called Address Transformation.
  • The regex formats go into the Format Regular Expression fields for both the Calling Address Transformation and the Called Address Transformation.


United Kingdom (UK) Country Code 44

Trunk Code 0

Exit Code 00


For national numbers, the regex to remove the +44 and add the trunk code 0.

Regex match ^(sip[s]?:|tel:)(\+)(44)(.*)

Regex format $1\x30$4

For example, this regex changes +443035551212 to  03035551212.


For the international numbers, the regex to remove the + and add exit code 00.

Regex match ^(sip[s]?:|tel:)(\+)(.*)

Regex format $1\x30\x30$3

For example, this regex changes +17165551212  to  0017165551212.


  • The regex matches go into the Match Regular Expression fields for both the Calling Address Transformation and the Called Address Transformation.
  • The regex formats go into the Format Regular Expression fields for both the Calling Address Transformation and the Called Address Transformation.