cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6199
Views
0
Helpful
2
Replies

regex to filter 2 and 4 digit extensions

zephynator
Level 1
Level 1

I am trying to modify internal DN presentation using a fairly well documented process with different partitions and CSS's, and all that is working great at the moment. The hitch I ran into is that we have 2-digit endpoints for a few critical services, namely overhead paging, code phone, and an internal hospital RF paging system, which are in their own partition (but really doesn't change this issue). So, in the translation pattern, if I specify "XXXX" as the pattern to look for, I have to wait for the interdigit timeout to expire before the call is processed for 2-digit endpoints. So, that will not work.

I researched a little into possible ways to describe the number range I am looking for in a true regex, and got kind of a mixed success rate. I can write something that works, based on some great input from some people on the stack overflow site (RegEx to exclude a specific string constant - Stack Overflow), but it doesn't cross over into Cisco-land, which I am sure I am not the first to report. I tried several modifications of one of the regex examples, specifically the ^(($)|([^f].*)|(f[^o].*)|(fo[^o].*)|(foo.+))$, which says, from the site "if it starts with non-f, the rest can be anything; if it starts with f, non-o, the rest can be anything; otherwise, if it starts fo, the next character had better not be another o". So, drop foo and insert logic for my criteria and Cisco does not appear to like the syntax.

My criteria are as follows:

All of the numbers from 1000 to 8999

except

33, 34, and 55

If I do something simple like [1246-8][126-8]XX, I can make it bypass the numbers listed as exceptions above, but I also end up bypassing some of my in-service DN's. Has anyone accomplished this, or something like it before? I would be very grateful for any advice on syntax for the regex.

2 Replies 2

zephynator
Level 1
Level 1

As a quick update, I am accomplishing this using a total of 5 translation rules to get around all the numbers. The regex on each of them is:

[1-2][0-9]XX

3[0-25-9]XX

4XXX

5[0-46-9]XX

[6-8]XXX

Seems to work pretty good, but I was really hoping to get it all in one statement. Thanks for looking!

Michael,

I recommend you also post this to the Cisco Support Community for additional feedback and information.

https://supportforums.cisco.com/

I hope this helps. Thank you for participating in the community.

Kelli Glass

Moderator for Cisco Customer Communities