JMeter正则表达式不处理带变量和“$”的字符串

时间:2022-06-01 20:15:23

Version: 3.0

版本:3.0

I want to use a variable to parse a response that includes a '$'

我想使用一个变量来解析一个包含“$”的响应

${__V(${Variable})}\)</a></span><!-- R_PAGE_POSITION\$(..?)

This is not bringing back a match, but does if I either replace the variable with a value e.g.

这不是返回匹配项,而是如果我用一个值来替换变量,例如。

12345\)</a></span><!-- R_CLASS_NAME\$(..?)

Or omit from the dollar sign onwards:

或从美元符号开始省略:

${__V(${Variable})}\)</a></span><!-- R_PAGE_POSITION

This suggests that there is some issue between the Variable syntax and the dollar sign that means they cannot co-exist.

这表明变量语法和美元符号之间存在一些问题,这意味着它们不能共存。

Anyone experience a similar issue?

有人遇到过类似的问题吗?

1 个解决方案

#1


3  

You need to use double backslash here:

你需要使用双反斜杠:

${__V(${Variable})}\)</a></span><!-- R_PAGE_POSITION\\$(..?)
                                                    ^^

That way, you let JMeter know that it is not a variable marker inside a JMeter expression (the first backslash), and that it is not the end-of-string anchor (the second backslash).

这样,您就可以让JMeter知道它不是JMeter表达式(第一个反斜杠)中的变量标记,也不是字符串的结束锚(第二个反斜杠)。

#1


3  

You need to use double backslash here:

你需要使用双反斜杠:

${__V(${Variable})}\)</a></span><!-- R_PAGE_POSITION\\$(..?)
                                                    ^^

That way, you let JMeter know that it is not a variable marker inside a JMeter expression (the first backslash), and that it is not the end-of-string anchor (the second backslash).

这样,您就可以让JMeter知道它不是JMeter表达式(第一个反斜杠)中的变量标记,也不是字符串的结束锚(第二个反斜杠)。