0

I have a HTTP Response from JMETER as :

[{"Id":null,"Message":"2578W,","IsError":false}]

I need to pass the message "2578W" into the next HTTP request. I am using the Regular Expression Extractor in JMETER. and passing the values as: Apply to Main Sample and sub-sample

Field to Check : Body
Reference Name: ${Message}
Regular Expression: [{"Id":null,"Message":"(.*?),","IsError":false}]
Match No. 1
Default Value: Not found

2 Answers 2

1

You need to escape these symbols [] with backslashes as they are Regular Expressions Meta Characters representing character classes

So I would recommend amending your Regular Expression to look like:

\[{"Id":null,"Message":"(.+?),","IsError":false}\]

Don't forget to set "Template" to $1$

JMeter Regular Expression

See Using RegEx (Regular Expression Extractor) With JMeter article for more details on performing correlation in JMeter tests using regular expressions.


Given you getting response in JSON format you may find JSON Extractor easier to use, the relevant JSON Path query will be as simple as

$..Message  
0

Try the folllowing regex:

,"Message":"(.*)",".* 

You can experiment easily on this link. Your original regex matches much much more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.