jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Lloyd <oliver_ll...@hotmail.com>
Subject Re: How can i extract from the same link matched two variables
Date Sat, 13 Aug 2011 09:54:42 GMT
Kudos to Deepak, I'm going to essentially repeat what he just said with
examples, to clarify.

So, imagine this is my response data:
name="name1", value="value1"
name="name2", value="value2"
name="name3", value="value3"

I want one regexp that will give me controlled access to each name and value
value. So here is my regular expression extractor config:
Reference Name: test
Regular Expression: name="([^"]+)".*value="([^"]+)"
Template: $1$,$2$
Match No: -1
Default: False

In my next statement I'm using:
test=${test}
test_1=${test_1}
test_1_g1=${test_1_g1}
test_1_g2=${test_1_g2}
test_2_g1=${test_2_g1}
test_2_g2=${test_2_g2}

The result for the above statement is:
test=False
test_1=name1,value1
test_1_g1=name1
test_1_g2=value1
test_2_g1=name2
test_2_g2=value2

Some important points:
1. Match No=-1 (that's minus 1) is essential for groups.
2. Template is not required, it only gets used when you do not use the g#
suffix, so, with Template blank, ${test_1} will be empty.
3. With Match No=-1, ${test} always = False (default value).
4. In this case, ([^"]+) == (.+?). But ([^"]+) is better, it's more
efficient.

--
View this message in context: http://jmeter.512774.n5.nabble.com/How-can-i-extract-from-the-same-link-matched-two-variables-tp4694651p4695839.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
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