cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1829
Views
5
Helpful
2
Replies

Help with RegEx to extend (?!.*@%localdomains%).*

Chris Swinney
Level 5
Level 5

Hi All,

I have been looking over some previous discussions (such as https://supportforums.cisco.com/message/3758886#3758886), documentation (such as https://supportforums.cisco.com/docs/DOC-25084 - which is very good BTW), and RegEx sites to see if I can com up with something to work for us.

The RegEx :

     (?!.*@%localdomains%).*

is used on the VSC-E search rule to forward URI lookups that do NOT have a SIP domain configured on the VCS. This is great but assumes that the search string is in a URI format usually accomplished by a transform in the VCS-E. At the moment we don't apply this transform as (in general), we route using the E.164 via the Global Dialling Scheme. In addition, the VCS-E is used as a traversal server to many VCS-C and potentially will host many SIP domains - so which one do I transform to?

The problem I have that without this domain conversion transform, the above RegEx actually matches non URI strings and the DNS search rule will be invoked. A DNS look for such a non domain would obviously fail but is pointless and time/resources consuming.

So I was wondering if ther was a way to construct the RegEx to not only fail when a string contains a domain as configured on the VCS (as above), but ALSO only to succeed when a valid URI is detected - i.e. some thing with an @ in it. I did come up with the following:

     ((?!.*@%localdomains%).*)|(.+@.+\..+)

but unfortunately this name overrides the main part of the RegEx as, of course, the configured domain used in a URI will also have an @ in them.

E.g. We have two domains configured on the VCS - mydom.com and otherdom.com

I need to ensure that the RegEx is ONLY true when a string contains a valid URI, but does NOT end in either mydom.com and otherdom.com

So:

     me@mydom.com -                Fail

     them@otherdom.com -          Fail

     us@cisco.com -                     Success

     0123456  -                              Fail

Perhaps (and to maybe answer my own question), I should just add a transform anyway and turn all non URI searches into a configured dummy domain (i.e. dummy.com). I can essentially ignore and strip this if the string contains a transformed E.164 number and route as normal, yet the DNS search rule will be prevented from firing.

Anyhow, thoughts welcome.

Chris

2 Replies 2

Chris Swinney
Level 5
Level 5

To answer my own question (2), if I can out the OR in the RegEx above, it all works.

     ?!.*@%localdomains%).*)(.+@.+\..+)

Danahh

Hi Cris,

I didn't even have time to suggest you anything... rsrs.

Five stars to you for answering your own question.   =)

Regards

Paulo Souza

Please rate replies and mark question as "answered" if applicable.

Paulo Souza Was my response helpful? Please rate useful replies and remember to mark any solved questions as "answered".