I am calling 2 different endpoints in my jmeter test. The first endpoint should provide me with a single number (for instance 568959) in its response body and then I must pass it to my second endpoint.

Here is the response of my first endpoint:

enter image description here

please notice the response contains a single number, and it is not a json response as you see in image.

and then I used a Regular Expression Extractor to extract this number from the body using a variable called newsId and regular expression as (.*) as below:

enter image description here

But, when I run my second request, I noticed it is sending an empty ${newsId} such as:

  • Can you share the publish news thread group, so we can spot some problem there. Jun 26, 2019 at 9:49

2 Answers 2


Am not sure about how you are passing the Regex values to the second end point. But try this below method. It may work.

After the Regex, add a Bean shell assertion and pass the variable newsId as


Explanation : ${newsId} -> Pass the regex variable here in the setProperty.

Now try passing the variable in the second end point. For reference please follow the below link.



You either need to amend your request and change ${newsId} to ${newsId_g0} or ${newsId_g1} as your setup generates the following JMeter Variables:

enter image description here

You can visualize defined JMeter Variables or Properties using Debug Sampler and View Results Tree listener combination, check out How to Debug your Apache JMeter Script article for more details.

Alternatively you can amend Template section of your Regular Expression Extractor and set its value to $1$

enter image description here

this way you will not need to change ${newsId} declaration

Your Answer

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

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