regexjmeterperformance-testingcorrelationpost-processor

I am doing correlation in Jmeter. I am facing below issue to find the Regular expression


<input type="hidden" name="_csrf"
                    value="40ea7f46-799b-4ca0-b8cd-4adfba082aed" />

Above is the token I am getting in the request output. I am unable to replace this with a regular expression in Regular Expression Extractor of Jmeter.

<input type="hidden" name="_csrf" value="(.+?)" /> is not working.

Please help.


Solution

  • If your input actually contains a newline character, then you need to account for that in your regex. Furthermore, better be explicit about the valid characters in your regex, .+ is rarely a good thing:

    <input type="hidden"\s+name="_csrf"\s+value="([^"]+)"\s*/>