Devang
Devang

Reputation: 385

want to extract Last Value from Jmeter RegEx

Actual matches are as below:

============================================
e.g.

Match count: 3

Match[1][0]=input type='checkbox' name='sheet_id' value="368">
Match[1][1]=368

Match[2][0]=input type='checkbox' name='sheet_id' value="372">
Match[2][1]=372

Match[3][0]=input type='checkbox' name='sheet_id' value="373">
Match[3][1]=373

I'm using RegEx as below:

====================================
RefName : sheetID

RegEx   : input type='checkbox' name='sheet_id' value="(.+?)">

Template : $1$

Match No : -1

====================================

And I'm using ${__V(sheetID_${sheetID_matchNr})} to get value, but I'm getting sheetID_0 as a result.

Upvotes: 3

Views: 1662

Answers (2)

Devang
Devang

Reputation: 385

I think there was some problem Related to Var Name i just Changed it to getSheetId and now ${__V(getSheetId_${getSheetId_matchNr})} works fine for me.

http://jmeter.apache.org/usermanual/functions.html

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168092

Your syntax of __V function is a little bit incorrect

As per documentation:

  • ${A1} - works OK

  • ${A${N}} - does not work (nested variable reference)

  • ${__V(A${N})} - works OK.A${N} becomes A1, and the __V function returns the value of A1

Given the following:

A=sheetID_
N=sheetID_matchNr

Your function should look like:

${__V(sheetID_${sheetID_matchNr})}

For advanced information on different JMeter functions check out How to Use JMeter Functions posts series.

Upvotes: 2

Related Questions