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
Bharat Mane
6,78512 gold badges42 silver badges69 bronze badges
asked Feb 16, 2017 at 11:55

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 
answered Feb 16, 2017 at 14:30
0

Try the folllowing regex:

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

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

Bharat Mane
6,78512 gold badges42 silver badges69 bronze badges
answered Feb 16, 2017 at 12:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.