Jmeter - regex problem with inline variable and $

Hello,

In the regex Jmeter component, I have a problem when the expression has both the AND variable and the literal '$'. He always comes back as a failure. When I replace a variable with a hard-coded value, it works fine. I checked that the variable returns the expected value in the previous call.

Expression failed: (variable and letter '$')

<option value="${variable}".+?>\$(.+?)</option> 

Working version: (no variable)

 <option value="1".+?>\$(.+?)</option> 

Alternatively, if I delete the literal '$', it works.

Alt Working expression: (variable, not literal '$')

 <option value="${variable}".+?>(.+?)</option> 

Thoughts?

+4
source share
3 answers

You can try [$] as an alternative to backslash escaping.

+2
source

The work around was replacing \ $ with \ W or \ S

+3
source

You can do this using the BeanShell function, which has access to the "vars" object.

For example, vars.get ("variable") is equivalent to $ {variable}.

Link 1 <- Search Bean on the page

+1
source

All Articles