Reputation: 7
I have the response below from a request:
"wd:Report_Entry" : [ {
"wd:referenceID" : "INTEGRATION_EVENT-6-60442",
"wd:Integration_System" : {
"@wd:Descriptor" : "Worker details for Mule Soft - CC",
"wd:ID" : [ {
"@wd:type" : "WID",
"$" : "04ce61fbe864013e1fa5b4ce1a9c6e17"
}, {
"@wd:type" : "Integration_System_ID",
"$" : "Worker_Details_MuleSoft_CC"
} ]
},
"wd:Created_Moment" : "2018-09-06T00:31:14.836-07:00"
}, {
"wd:referenceID" : "INTEGRATION_EVENT-6-60441",
"wd:Integration_System" : {
"@wd:Descriptor" : "Worker details for Mule Soft - CC",
"wd:ID" : [ {
"@wd:type" : "WID",
"$" : "04ce61fbe864013e1fa5b4ce1a9c6e17"
}, {
"@wd:type" : "Integration_System_ID",
"$" : "Worker_Details_MuleSoft_CC"
} ]
},
"wd:Created_Moment" : "2018-09-06T00:28:34.301-07:00"
}
I need to capture wd:referenceID
value (multiple values), for example INTEGRATION_EVENT-6-60441
and pass it to the next request.
I have tried Regular expression "wd:referenceID" : (.*?)",
. Its capturing "INTEGRATION_EVENT-6-60441"
with double quotes. I would require the INTEGRATION_EVENT-6-60441
(without double quote) and need to loop number of times of the Reference ID for the next request).
Upvotes: 0
Views: 2078
Reputation: 168122
You need to surround your regular expression with quotation marks like:
"wd:referenceID" : (.*?)",
This way the quotation marks will not be included into the group and you will get "clean" value:
One more thing to consider: your response is utterly like to be a JSON, if so - using regular expressions is not the best idea. JMeter provides JSON Extractor which allows executing arbitrary JSON Path queries to fetch "interesting" parts of the response, in your case the relevant JSON Path expression would be:
$..wd:referenceID
Upvotes: 1
Reputation: 1999
Check the below Regular Expression
Below you can see the output that all the values are getting retrieve without double quotes.
Now, you can get the values via var_referenceID_1,var_referenceID_2 etc.
Hope this helps.
Upvotes: 1