Home > Software engineering >  regex in JMeter to get a specific value
regex in JMeter to get a specific value

Time:08-19

i have the below response in JMeter where i need to pass the sign value in the next session for the request to process. i used the below regex &sign=(.*) which results in total value which don't want. any help is appreciated

&sign=3aab2959b89c06dd43d369bfd06ec614&return=001

CodePudding user response:

You may phrase your regex as stopping before hitting an ampersand & in the query string, should one exist:

\bsign=([^&] )

The leading \bsign portion should match sign preceded by either ? or &. We then capture ([^&] ), which capture either until the end of the query string, or the nearest & separator, whichever occurs first.

CodePudding user response:

You need to amend your regular expression to be something like:

sign=(. ?)&

enter image description here

As per enter image description here

  • Related