Jmeter - Regex issue with embedded variable and $
Question
Greetings,
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>
Working Version: (no variable)
<option value="1".+?>\$(.+?)</option>
Alternately, if I remove the literal '$', it works.
Alt. Working Expression: (variable, no literal '$')
<option value="${variable}".+?>(.+?)</option>
Thoughts?
Solution
You could try [$]
as an alternative to escaping it with a backslash.
OTHER TIPS
Work around has been to replace \$ with \W or \S
You could do it using a BeanShell function, which has access to the "vars" object.
For example, vars.get("variable") is equivalent to ${variable}.
Link 1 <-- Search for Bean on the page