'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
Solution 1:[1]
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
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dmitri T |
| Solution 2 | user7294900 |
