jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: A problem while trying foreach+regex example
Date Fri, 24 Sep 2004 22:52:15 GMT
You're right - the regex is wrong - it should be:

<a href="([^"]+)"

rather than

<a href="([^"])"

which will only match 

<a href="?"

where ? is any single character. 

Adding the + means it will match 1 or more characters (any character
except " - so that it stops when it reaches the closing "..

Fixing this allows the regex to work, however as it stands it will
only work with URLs that don't contain the host name, because the
result is used in the path field.

For example: <a href="/index.html"> should work, but <a
href="http://www.host.tld/fred.html"> won't.

I'll fix the sample shortly to add the +; fixing it so that it works
with all kinds of URLs is probably much harder.

The reason that the returnVar is not set is because the regex
extractor behaves differently for a negative match number, and does
not set inputVar_1 to the default if no matches were found.

Thanks for reporting the problem - sorry for any inconvenience you were caused.

S.
P.S. The regex coach is well worth investigating - see link from
JMeter Wiki http://wiki.apache.org/jakarta-jmeter/RegularExpressions

On Fri, 24 Sep 2004 14:41:08 -0400, Grace Li <grace.li@thespigroup.com> wrote:
> Hi all,
> 
> I am trying the example testplan linked in the section 'foreach
> controller' in jmeter manual.  It is am example using the combination of
> foreach and regex.
> 
> I gave a link to a real html page which has several links inside. But
> the test result shows http request failure. Looking into the response
> data, it could be found that ${returnVar} was not set a value. It's
> either the regular expression is not right or something else wrong.
> 
> Can anyone shed me a light?
> 
> thanks!
> Grace
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
>

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


Mime
View raw message