Jmeter-带有嵌入式变量和$的正则表达式问题 [英] Jmeter - Regex issue with embedded variable and $
问题描述
问候,
在Jmeter的正则表达式组件中,当表达式同时具有变量和文字' $ '时,我遇到了一个问题.它总是返回失败.当我用硬编码值替换变量时,它可以正常工作.我已验证该变量在上一次调用中返回了期望值.
In Jmeter's regex component, I am running into an issue when the expression has both a variable AND a literal '$'. It always returns as fail. When I replace the variable with a hardcoded value, it works fine. I have verified the variable is returning the expected value in previous call.
失败的表达式:(变量和文字'$')
Failed Expression: (variable and literal '$')
<option value="${variable}".+?>\$(.+?)</option>
工作版本:(无变量)
<option value="1".+?>\$(.+?)</option>
或者,如果我删除文字' $ ',它将起作用.
Alternately, if I remove the literal '$', it works.
替代项.工作表达式:(可变,无文字"$")
Alt. Working Expression: (variable, no literal '$')
<option value="${variable}".+?>(.+?)</option>
有想法吗?
推荐答案
您可以尝试使用[$]
作为用反斜杠将其转义的替代方法.
You could try [$]
as an alternative to escaping it with a backslash.
这篇关于Jmeter-带有嵌入式变量和$的正则表达式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!