循环通过多个Regex提取器输出 [英] Looping through multiple Regex extractor output
问题描述
您能告诉我如何遍历返回多个值的Regex Post Processor的结果吗?
Can you please tell me how to loop through the result of a Regex Post Processor that returns multiple values?
示例:
JSON响应消息:
{
"reply": {
"code": "111",
"status": "SUCCESS",
"customerID": [
"222-a",
"b-333",
"44-4",
"s-555",
"666",
"777",
"88-8"
]
}
}
Regx提取器帮助我提取数组的每个单独成分:
Regx extractor helped me extract each individual component of the array:
links_1=222-a
links_2=b-333
我可以使用some.url/${links_1}
.
这正是我要实现的目标,但这似乎行不通.
你能帮我吗?
I can use some.url/${links_1}
.
Here is exactly what I am trying to achieve, but this does not seem to work.
Can you please help me?
使用一个计数器遍历正则表达式提取的单个变量,并将每个变量附加到另一个HTTP请求采样器中:
Loop through the Regex extracted individual variable using a counter and append each one in another HTTP request sampler:
WhileController(${__javaScript(${C} < ${links_matchNr})})
HTTPSampler use ${__V(links_${C})}
Counter (start=1,increment=1,maximum=${links_matchNr},referenceName=C)
推荐答案
使用 ForEach控制器:
-
输入变量:链接
input variable : links
输出变量:例如链接
然后您可以通过以下方式在Controller中使用每个值:
You can then use each value inside Controller through:
$ {link}
${link}
这篇关于循环通过多个Regex提取器输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!