Gaurav
Gaurav

Reputation: 63

Jmeter Regular Expression Extractor not giving results

I have recorded a workflow in Jmeter using Recording controller. In that workflow, a URL parameter 'member_id' get generated and appear in URL. This 'member_id' is getting used further in the workflow.

In the recorded script, value of 'member_id' is saved in a variable. Screenshot

Here the problem is; When I execute the scripts, then instead of newly generated 'member_id', the saved value is getting used in the later samples. I want to fetch the new value and update the saved value, so that it can be used in later samples

I have tried to fix this issue by fetching the 'member_id' from the URL and save it in a variable

I have tried 'Regular Expression Extractor' but I am not able to read the value. Screenshot

But when I print the response, I am getting only first digit of new 'member_id'. Screenshot

Upvotes: 0

Views: 587

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

You're using wrong regular expression, it stops whenever it finds the first match

According to the JMeter documentation on Regular Expressions:

( and ) these enclose the portion of the match string to be returned

. match any character

+ one or more times

? don't be greedy, i.e. stop when first match succeeds

enter image description here

So the solution will be to remove the question mark from your regular expression:

member_id=(.+)

enter image description here

or even better, if you're looking for numbers you should limit your search criteria to digits only like:

member_id=(\d+)

References:

Upvotes: 0

Related Questions