Mattje
Mattje

Reputation: 33

JMeter Regular Expression Not Handling String with Variable and '$'

Version: 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?

Upvotes: 2

Views: 232

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627087

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).

Upvotes: 3

Related Questions