You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "BAZLEY, Sebastian" <se...@atosorigin.com> on 2004/08/18 11:42:14 UTC

RE: Regular expression extractor -- regex modifiers?

This is covered in the JMeter FAQ ...
http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-838de59592f482b07dd7c7f
14a25e3667b8f1863

S.
-----Original Message-----
From: Sonam Chauhan [mailto:sonam.chauhan@ce.com.au]
Sent: 18 August 2004 05:38
To: 'JMeter Users List'
Subject: Regular expression extractor -- regex modifiers? 


Hi: I hit a problem with the JMeter Regular Expression Extractor. 

>From a HTTP response, I need to extract text which occurs after some
"marker". The problem is that this "marker" occurs several lines before the
text.  So I need to do a multi-line match. 

For e.g.: to extract out the value of url="..." (which occurs below
"MARKER"):
------------------------
url="..."
...
url="..."
...
MARKER
...
url="<extract me please>"
------------------------

I set the JMeter regex extractor to: 
        MARKER.+?url=\"(.+?)\"
But this does not match because there are newlines between MARKER and the
text to extract.


In Perl, I am able to append a '/s' modifier to the same regex:
        /MARKER.+?url=\"(.+?)\"/s
This works because it forces Perl to treat the regular expression in
multi-line string mode. From "perldoc perlre": 
-------------------------------------------------------------------
       s   Treat string as single line.  That is, change "." to
           match any character whatsoever, even a newline, which
           normally it would not match.
-------------------------------------------------------------------


Is there a way to force the JMeter regex extractor to take Perl-like regex
modifiers?

With regards,
Sonam Chauhan
-- 
Corporate Express Australia Ltd.
Phone: +61-2-9335-0725, Fax: 9335-0753, Email: sonamc@ce.com.au

PS: Right now, I have a nasty workaround. I set the regex to ignore either
normal or newline characters:
        MARKER(.|\r|\n)+?url= \"(.+?)\"
...and I use $2$ instead of $1$. 



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


_______________________________________________________

This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive this
e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos Origin group
liability cannot be triggered for the message content. Although the
sender endeavours to maintain a computer virus-free network, the
sender does not warrant that this transmission is virus-free and will
not be liable for any damages resulting from any virus transmitted. 
_______________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org