×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

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

Unanswered Question
Jul 27th, 2013
User Badges:
  • Silver, 250 points or more

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:

     [email protected] -                Fail

     [email protected] -          Fail

     [email protected] -                     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

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Chris Swinney Sat, 07/27/2013 - 14:23
User Badges:
  • Silver, 250 points or more

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


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


Danahh

Paulo Souza Sat, 07/27/2013 - 14:59
User Badges:
  • Gold, 750 points or more

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.

Actions

This Discussion