从使用 -1 获取所有匹配项的正则表达式提取器,以及如何选择最后一个作为 jmeter 中的匹配项
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
匹配结果总数以多少为准
如果您的变量是 a
使用 __V 获取最后一次使用
${__V(a_${a_matchNr})}
${__evalVar(a_${a_matchNr})}
a_matchNr return 最后一个数字
refName_matchNr - the number of matches found; could be 0
根据 Regular Expression Extractor 文档:
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
因此匹配总数存储在${refName_matchNr}
JMeter 变量
如果你想动态获得最后一场比赛,你可以使用 __V() function 像:
${__V(refName_${refName_matchNr})}
将refName
替换为你自己的JMeter变量引用名
匹配结果总数以多少为准
如果您的变量是 a
使用 __V 获取最后一次使用
${__V(a_${a_matchNr})}
${__evalVar(a_${a_matchNr})}
a_matchNr return 最后一个数字
refName_matchNr - the number of matches found; could be 0
根据 Regular Expression Extractor 文档:
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
因此匹配总数存储在${refName_matchNr}
JMeter 变量
如果你想动态获得最后一场比赛,你可以使用 __V() function 像:
${__V(refName_${refName_matchNr})}
将refName
替换为你自己的JMeter变量引用名