Search code examples
javaregexjmeterperformance-testing

complex regular expression in jmeter


I have the following fragment from an http response of a test script I tested on JMeter.

"info":"{\"scno\":\"External_Interaction_Step7\",\"sdn\":\"CASHDEP - Cash    Deposit - Capture Transaction Details\",\"dtype\":\"Form\",\"sname\":\"BT_TTB_CashDep_PRC\",\"sid\":\"85684c370c4410aa%1?934?-1\"}"},"header":{"un":"salamaj1","appId":"BFBT","ut":"1?856849590bff1957?-1"}}}

Now, I want to get the value of the "sid" variable for correlation purposes since it's dynamic. I am currently using this regular expression

\"sid\":\"(.+?)\"

to get the value of sid which is 85684c370c4410aa%1?934?-1. But it's not working. Any suggestions?


Solution

  • Backslash is an escape character and so, needs to be escaped. Try:

    \\"sid\\":\\"(.+?)\\"