08-13-2012 02:22 AM - edited 03-16-2019 12:40 PM
Hello,
Please help to create a voice translation rule that will prefix 9 to any longer 5 digits.
12345 -> 9123435
123456 -> 9123456
1234 -> 1234
Thanks
Solved! Go to Solution.
08-13-2012 02:43 AM
You must use a voice rule with number slice:
You can use number slice when you need to copy parts of a matched number across to the replacement number. You slice the matched number into sets that you can keep or ignore.
Character | Description |
---|---|
\ | In the match pattern, indicates where to slice up the number. |
\ | In the replacement pattern, indicates where to copy the sets to keep. |
( ) | Indicates which sets in the matched number to keep. |
Character Usage | Description |
---|---|
(a\) | Keep expression "a". |
b\ | Ignore expression "b". |
\1 | Copy the first set into the replacement number. |
This example provides a general explanation.
/ (x\) y\ (z\) / /w\1\2/
Split the matched number into three sets of x, y, and z. The backward slash (\) indicates the places to slice up the number. The brackets () indicate which sets you want to reuse in the replacement pattern. The w represents additional digits to insert into the replacement number.
The replacement number is a concatenated number: wxz.
This example provides further detail:
voice translation-rule 1 rule 1 /^\(12\)3\(45\)$/ /6\1\2/
router#test voice translation-rule 1 12345 Matched with rule 1 Original number: 12345 Translated number: 61245
An example can be:
voice translation-rule 1
rule 1 /^\([0-9]...\)/ /9\1/
- copy every numbers with 5 digit and started with a digit between 0 or 9
- prepend 9
Regards.
08-13-2012 02:43 AM
You must use a voice rule with number slice:
You can use number slice when you need to copy parts of a matched number across to the replacement number. You slice the matched number into sets that you can keep or ignore.
Character | Description |
---|---|
\ | In the match pattern, indicates where to slice up the number. |
\ | In the replacement pattern, indicates where to copy the sets to keep. |
( ) | Indicates which sets in the matched number to keep. |
Character Usage | Description |
---|---|
(a\) | Keep expression "a". |
b\ | Ignore expression "b". |
\1 | Copy the first set into the replacement number. |
This example provides a general explanation.
/ (x\) y\ (z\) / /w\1\2/
Split the matched number into three sets of x, y, and z. The backward slash (\) indicates the places to slice up the number. The brackets () indicate which sets you want to reuse in the replacement pattern. The w represents additional digits to insert into the replacement number.
The replacement number is a concatenated number: wxz.
This example provides further detail:
voice translation-rule 1 rule 1 /^\(12\)3\(45\)$/ /6\1\2/
router#test voice translation-rule 1 12345 Matched with rule 1 Original number: 12345 Translated number: 61245
An example can be:
voice translation-rule 1
rule 1 /^\([0-9]...\)/ /9\1/
- copy every numbers with 5 digit and started with a digit between 0 or 9
- prepend 9
Regards.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide