Hi All.
Firstly I am not good at regex, so I have been reading tutorials and
looking at this site (http://regex101.com/) to practise my matching
techniques.
using the following example Via headers I want to match the port number
when it is available.
e.g.
TEST1: Via: SIP/2.0/UDP 192.168.0.65;rport;branch=z9hG4bK380
TEST2: Via: SIP/2.0/UDP 192.168.0.65:5060;rport;branch=z9hG4bK380
TEST3: Via: SIP/2.0/UDP 192.168.0.65:15080;rport;branch=z9hG4bK380
(don't get tied up on the rport syntax)
I expect that the matches for each of the three Test samples should be as
follow
TEST1='' (no match)
TEST2='5060'
TEST3='15080'
Using the following regex in the website I get my desired outcome:
.*:([0-9]{4,5})[:;]
I am sure that this will not be the best way but certainly it works in the
website just fine.
however when I use it an SIPp xml file I never get the same match as the
website suggest
example for input sample TEST2
the match is SIPp is
SIP/2.0/UDP 192.168.0.65:5060;
I am using this in the SIPp xml file
<recv request="REGISTER" crlf="true">
<action>
<ereg regexp=".*:([0-9]{4,5})[:;]" search_in="hdr" header="Via:"
assign_to="vPort" />
</action>
</recv>
I would like to have a reliable way to develop and test the regex in a
interactive tool such as the website I am using that returns the same
results when I use the epression in SIPp, can someone guide me to what I
need to do to accomplish this goal.
Also fro the case of TEST1 where there is no match I would like that vPort
be assigned a default value of 5060, if there is a way to achieve this
outcome that would be great to know also.
Thanks
Paul
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users