Everest
Everest

Reputation: 51

From the regular expression extractor using -1 for getting all matches, and from that how to choose the last one as a match in jmeter

Whatever may to the total number of matching outcomes

Upvotes: 0

Views: 560

Answers (2)

Dmitri T
Dmitri T

Reputation: 168092

As per Regular Expression Extractor documentation:

If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:

refName_matchNr - the number of matches found; could be 0

refName_n, where n = 1, 2, 3 etc. - the strings as generated by the template

refName_n_gm, where m=0, 1, 2 - the groups for match n

refName - always set to the default value

refName_gn - not set

So the total number of matches is being stored in ${refName_matchNr} JMeter Variable

If you want to get the last match dynamically you can use __V() function like:

${__V(refName_${refName_matchNr})}

Replace refName with your own JMeter Variable reference name

More information: Here’s What to Do to Combine Multiple JMeter Variables

Upvotes: 0

Ori Marko
Ori Marko

Reputation: 58782

If your variable is a use __V for getting last occurrence using

${__V(a_${a_matchNr})}

or __evalVar

${__evalVar(a_${a_matchNr})}

a_matchNr return last number

refName_matchNr - the number of matches found; could be 0

Upvotes: 1

Related Questions