Search code examples
regexperformance-testingjmeter-5.0jmeter-4.0

How to extract the userkey value when %2F is present in an expression in jmeter


I am creating a script in JMeter for performance testing!
I need to get the userkey form the response header.
As we can see below is the short response for the same:
&Userkey=AMfN%2Fm1wlh

And I tried using the below regex:
Userkey=(.+?)\n
Userkey=(.+?)%2F(.+?)\n
But didn't got solution using post processor, i.e. regular expression extractor in JMeter


Solution

  • Try the following regular expression:

    Userkey=(.*)
    

    Where:

    • . - matches any character
    • * - repetition
    • () - grouping

    As you can see it produces a match in "RegExp Tester" mode of the View Results Tree listener:

    enter image description here

    More information: