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
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ドル$
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
Try the folllowing regex:
,"Message":"(.*)",".*
You can experiment easily on this link. Your original regex matches much much more.