Gareth, how about having *several simple* regexp extractors (important: each of them with an empty default value) so the match number problem is solved? Next step you concatenate your results to one final result and there you are...
Best regards / Viele Grüße
Noam Paz
Gareth Western <[EMAIL PROTECTED]>
26.01.2006 16:58
To
[email protected]
cc
Please respond to
"JMeter Users List" <[email protected]>
Subject
Regex to extract hidden input AND url parameter
Hi All,
I'm trying to write a regular expression to extract the value for a variable
from each HTML response in my test script. This value is dynamically generated
for each page, and can either be a hidden input (ie in a form) or a parameter
on the end of a link.
The variable name is always: org.apache.struts.taglib.html.TOKEN
The value has variable length, but is always a series of alphanumeric
characters.
I've been working on this regex using the Jakarta ORO demonstration applet at:
http://jakarta.apache.org/oro/demo.html
The example text i've been using for the ORO applet is:
<input type="hidden" name="foobar" value="bazbar" />
<input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="token1"/>
<a href="myAction.do?org.apache.struts.taglib.html.TOKEN=token2&myName=Gareth"
/>
<a href="myAction.do?org.apache.struts.taglib.html.TOKEN=token3" />
<a href="myAction.do?foo=bar&org.apache.struts.taglib.html.TOKEN=token4" />
Finally, the regular expression is as follows:
org\.apache\.struts\.taglib\.html\.TOKE(?=N['"][\s]value=['"]([^'"]+))|(?=N=([^&'"]+))
I removed the "N" from the token to prevent the regex matching all parameters in
a URL (e. "Gareth" from
"org.apache.struts.taglib.html.TOKEN=token2&myName=Gareth")
The only problem remaining, as you can see if you run the regex and the sample
text in the applet, is that each "half" of the regex (ie the half to check
hidden inputs, and the half to check the URLs) returns two matches, therefore I
can't know which "match no" to specify for the Regular Expression Extractor in
JMeter.
Thanks very much if you're still reading this far, and even bigger thanks if you
can help me out!
Regards,
Gareth
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

