How can I pass dynamic value using regular expression in JMeter.

enter image description here I need to pass the payment id from request to subsequent request.

enter image description here

Tried with that...But the default value only passing as shown in the image...enter image description here

enter image description here.imgur.com/HMeXa.png

4 Answers 4


The primary way to pass the dynamic value in Performance Testing (using any tool) is through Correlation.

Correlation is extracting value from one of the requests which can be used in the subsequent request or any of the request which must be executed further.

Steps for correlating:

(1) Create a Test Plan- Either Template or Manual

(2) Add required listener, sampler, pre-processor, post-processor

(3) There might be an HTTP request with dynamic value -> highlighted (session-id, etc.) enter image description here

(4) Add regular expression extractor to the request with required boundaries. Every dynamic value requires a set of Regular expression.

Ex: (.+?) . - is used for search (a-z) [0-9] + is used for repeatitive ? is used for -might or might not be under

like below enter image description here

These are the steps that will help you achieve Correlation in JMeter. Thanks for reading!!

  • Hi Thanks for your suggestion...But i am unable to pass the valuer with Regular expression extractor..
    – syed
    Jul 25, 2019 at 12:45
  • Hi Syed, It might happen due to below reasons 1. The selected boundaries are incorrect 2. Occurrence (Response body, Header or number) 3. Also sometimes the boundaries are dynamic too 4. Last but most important one, if the regular expression is incorrect. Therefore, if you could share your response body with us. We would be able to help more.
    – ImpactQA
    Jul 26, 2019 at 7:09

You can use the Regular Expression Extractor.

You can simply select URL as Field to check and capture the end of the URL and place in a variable, which can be used afterwards.

enter image description here

  • Changes made as shown in the image...but it only passing the value which i have configured in subsequent request
    – syed
    Jul 26, 2019 at 6:05

Here i have attached my response bodyenter image description here

  • @ImpactQA here i have attached my response body. in that response body i need to capture the payment id which is dynamic for every request and need to send in subsequent request.
    – syed
    Jul 26, 2019 at 9:38
  1. Change "Field to check" to Body
  2. Change Regular Expression to be:


Other settings look fine

More information:

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.