AnsweredAssumed Answered

regex to filter 2 and 4 digit extensions

Question asked by zephynator on Sep 26, 2016
Latest reply on Sep 28, 2016 by kelli.glass

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.

Outcomes