cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3001
Views
0
Helpful
1
Replies

voice translation rule (prefix)

Eugen Bitca
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

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.

CharacterDescription
\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 UsageDescription
(a\)Keep expression "a".
b\Ignore expression "b".
\1Copy the first set into the replacement number.

Generic Example

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.

  • Set 1 becomes expression x.
  • Set 2 becomes expression z.
  • Expression y is ignored.

The replacement number is a concatenated number: wxz.

Specific Example

This example provides further detail:

voice translation-rule 1
 rule 1 /^\(12\)3\(45\)$/ /6\1\2/
  • Set 1: 12
  • Set 2: 45
  • Ignore: 3
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.

View solution in original post

1 Reply 1

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.

CharacterDescription
\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 UsageDescription
(a\)Keep expression "a".
b\Ignore expression "b".
\1Copy the first set into the replacement number.

Generic Example

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.

  • Set 1 becomes expression x.
  • Set 2 becomes expression z.
  • Expression y is ignored.

The replacement number is a concatenated number: wxz.

Specific Example

This example provides further detail:

voice translation-rule 1
 rule 1 /^\(12\)3\(45\)$/ /6\1\2/
  • Set 1: 12
  • Set 2: 45
  • Ignore: 3
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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: