Regex in jmeter | JMeter Forum
R
Reetika Posted on 02/12/2019

Hi team,

I am trying to extract the regular exp from one response where i have two different values :-

1.id 

2.status.

response:-

"id": "59f19829-7dce", "system_number": "c693", "age": 5.0, "home": "", "status": "AI","id": "779f19829-7dce", "system_number": "c693", "age": 5.0, "home": "", "status": "N/A",

I want to extract the id whose reproduction is AI .can you please tell me how can i extract these two and use in next request.Please help


S
Support Desk Replied on 04/12/2019

Now in this case, you can extract data in two ways:

1: Bt using Regex Extractor

\"id\"\: \"(.+?)\"\, \"system\_number\"\: \"(.+?)\"\, \"age\"\: (.+?)\, \"home\"\: \"\"\, \"status\"\: \"(.+?)\"

This will extract ID as $1$ and Status as $4$

2. You can make use of JSon Path Extractor. Which is more efficient.
copy paste the json in the given url and try generating the jsonpath there
Possible Matches $.id and $.status
https://jsonpath.com/