05-04-2023 05:34 AM
Hi,
I want to use voice translation-rule to reject specific number.
This number has format starting with +4917
If I attempt to add it like below:
rule 3 reject /^+4917XYZ/ it is not being accepted
Same with rule
3 reject /+4917XYZ/ it is not being accepted either
Please advise
Thanks
Solved! Go to Solution.
05-04-2023 05:52 AM - edited 05-04-2023 05:52 AM
The backslash is an escape character in regular expressions, so in order to match a literal plus sign (+), you need to escape it with another backslash. So, the correct syntax to match a string that starts with "+4917" using a regular expression in a Cisco voice translation-rule would be:
rule 3 reject /^\+4917/
Note that the first backslash escapes the second backslash, which in turn escapes the plus sign.
05-04-2023 05:42 AM - edited 05-04-2023 05:53 AM
Hello @ziqex,
In your case, you can use the following command to reject the number starting with +4917:
rule 3 reject /^\+4917/
05-04-2023 05:49 AM
Is there any difference between rule 3 reject /^\+4917/ and rule 3 reject /^\\+4917/?
Thanks
05-04-2023 05:52 AM - edited 05-04-2023 05:52 AM
The backslash is an escape character in regular expressions, so in order to match a literal plus sign (+), you need to escape it with another backslash. So, the correct syntax to match a string that starts with "+4917" using a regular expression in a Cisco voice translation-rule would be:
rule 3 reject /^\+4917/
Note that the first backslash escapes the second backslash, which in turn escapes the plus sign.
05-04-2023 05:46 AM
You need to escape special characters, like a plus, in the match part of the rule. To do that add a \ in-front of the character, ie \+.
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