The
MS Teams Dial plan forms use regex strings to perform digit translations (see
Creating a Dial Plan). For these, it is important to understand the role of
( ) brackets in the original digit pattern and the
$ elements in the translations.
The strings use ( ) brackets to group elements in the original match. The translations refer to each pair of brackets using the format $n in the translation. That is, $1 represents the characters matched by the regex pattern in the first pair of brackets, $2 the second pair of brackets, and so on.
Regex numbers the brackets in order of the opening ( bracket symbols from left-to-right in the original patterns. That includes patterns with nested bracket pairs, for example ((\+44)|(044)|(0)) contains $1 [((\+44)|(044)|(0))], $2 [(\+44)] , $3 [(044)], and $4 [(0)].
|
Name
|
Original Number
|
Pattern
|
Translation
|
Translated Number
|
|
Add UK 01632 area code to any 6-digit numbers
|
309348
|
^(\d{6})$
|
01632$1
|
01632 309348
|
|
Add US 416 area code to 7-digit numbers
|
555 0134
|
^(\d{7})$
|
416$1
|
416 555 0134
|
|
Change 00 prefix numbers to E.164 format
|
0044 1632 309348
|
^00(.+)$
|
+1$1
|
+44 1632 309348
|
|
001 416 555 0134
|
+1 416 555 0134
|
|
Change E.164 format numbers to non-E.164 format
|
+44 1632 309348
|
^\+(.*)$
|
00$1
|
0044 1632 309348
|
|
+1 416 555 0134
|
001 416 555 0134
|
|
Convert an international number back to a national number
|
0044 1632 309348
|
^(00|\+)44(.+)$
|
0$2
|
01632 309348
|
|
+44 1632 309348
|
01632 309348
|