jMeter – Regular Expression Extractor – Submit Form with Token

Problem:
Create a load test that submits a web form containing a unique token to prevent multiple form submissions.

Solution:
jMeter 2.6
Use jMeter Regular Expression Extractor ( Found in Right Click Menu >> Add >> Post Processors >> Regular Expression Extractor)

How To:
On http request 1 there will be a hidden input field that contains the token to be submited.
On http request 2 we will need to place this token value.

On http request 1, add a regular expression extractor with the following values.

Reference Name:TOKEN
Regular Expression:name=”TOKEN” value=”(.+?)”>
Template:$1$
Match No:1
Default Value: NOT FOUND

On http request 2 insert the token value into the paremeters section with the variable ${TOKEN}