I have this string :
Location →/cochise/workflow/5c46e69364ddf300013412b5
How do I extract the final hexadecimal code using jmeter?
Add a Regular Expression Extractor
post processor as a child of your request with below configurations:
Main sample and sub-samples
Response Headers
myVar
Location: .+\/(.*?)\n
$1$
1
NOT_FOUND
Now you can use jmeter variable ${myVar}
which contains hexadecimal value. You can add view results tree and debug sampler at thread group level to make sure you are extracting the right value.
References
The easiest is going for the Regular Expression Extractor
Configure it as follows:
for your convenience here is the textual form of the regular expression:
/cochise/workflow/(.*)
That's it, you should now be able to access the extracted value as ${foo}
where required.
Also be aware that you can test your regular expressions via RegExp Tester
mode of the View Results Tree listener. This approach in conjunction with i.e. Dummy Sampler can greatly speed up scripts development process as you will not have to re-run the entire scenario in order to test an extractor:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With