cancel
Showing results for
Did you mean:
cancel
Announcements
2095
Views
0
1
Replies
Highlighted
Beginner

## voice translation rule (prefix)

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
Highlighted
Rising star

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.

Highlighted
Rising star

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.