Forum Discussion
Raymond_Feng_97
Jul 30, 2012Historic F5 Account
urgent: need help for regular expression ?
Hi, all
Sorry , I am on site , can anybody help to create one line simple iRule to get the FQDN from the below sip string ?
ECSCF-Simulator7.P-LRF.com;lr>
Route: ECSCF-Simulator7.P-LRF.com;lr>
Contact: sip.test-site2.ERICSSON2.com:5060>
the fqdn is after "sip:" and "@" (if exist") and before ":" or ";"
I want to set the fqdn to one value and do dns query for this domain name , and then change change the destination ip to be that address.
Thanks.
Raymond
5 Replies
- hoolio
Cirrostratus
Hi Raymond,
Can you post the input sample in [ code ] [/ code ] blocks without the spaces?
Here's a related post you can reference as well:
https://devcentral.f5.com/Forums/tabid/53/aft/60465/Default.aspx60474
Thanks, Aaron - Raymond_Feng_97Historic F5 Account
Route: Contact:
I want get the FQDN out of the SIP header string , like "sip.test-site2.ERICSSON2.com" and "ECSCF-Simulator7.P-LRF.com" . Thanks. - hoolio
Cirrostratus
Can you post a few more examples of the two different header values?
Are you able to parse the route and contact headers using separate logic?
Here's a first stab at a combined regex that matches the domain of both examples you've shown:
(?:(?<=@).*?(?=;|:)|(?<=
Aaron - Raymond_Feng_97Historic F5 AccountSure I can using separate logic for Route and contact , actually my question is focus the FQDN may or may not have "@" .
Contact: Contact: Contact: Contact:
these is four examples , can I get the sip.test-site2.ericsson2.com with same regex ? - hoolio
Cirrostratus
The last regex didn't render correctly. And as TCL advanced regexes don't support lookbehinds, the regex won't work. You can do two scan commands for this though:when RULE_INIT { Loop through some test strings: foreach str [list {} {} {} {} {} {}] { Scan assuming a format of
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects