Search code examples
regexjmeterbeanshell

Extract value from beanshell extractor


I want to get the Sessiondatakey value from URL,How to write a regular expression in JMeter?

https://localhost:9443/authenticationendpoint/consent.do?mandatoryClaims=0_Nick+Name&sessionDataKey=ef91eee8-b226-4640-bf56-82df2a03ce78&sp=travelocitySP1

I tried with the below regex, but its gives the default value.

sessionDataKey=(.+)

Solution

  • Your sessionDataKey ends with & so add it to regular expression:

    sessionDataKey=(.+)&
    

    Make sure the Field to check is URL and Template is $1$ and Match No. is 1