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


As described in Transform outbound addresses with regular expressions, you can use regular expressions to transform the number sent on an outbound call. Here you’ll find some examples and descriptions that will show you how to use regular expressions to accomplish this task.

Note: You can only use regular expressions to transform the number sent on an outbound call if you are using a BYOC Premises external trunk. For more information, see About BYOC Premises.


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

regex format $1$3

For example, this regex changes sip:+17165551212@domain.com to sip:17165551212@domain.com.


  • 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}1${3}

For example, this regex changes sip:+17165551212@domain.com to sip:117165551212@domain.com.


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

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

Regex format ${1}011${3}

For example, this regex changes sip:+443035551212@domain.com to sip:011443035551212@domain.com.


  • 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}0${3}

For example, this regex changes sip:+443035551212@domain.com to sip:03035551212@domain.com.


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

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

Regex format ${1}00${3}

For example, this regex changes sip:+17165551212@domain.com to sip:0017165551212@domain.com.


  • 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.