-1
<input                                                     
 name="formToken"                  type="hidden"
 value="19225544fb878c9a8c77dafdfe616454a13e3c96"
/>

above is the line having lot of space in between. i want to extract value using regular expression in Jmeter. so please help me for regular expression to extract.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360

3 Answers3

1

Try doing a find on this regex:

value="([^"]+)"

And then access the following in the template:

$1$

See the demo link below for an example of this working.

Demo

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
1

Be informed that using Regular Expression Extractor for parsing HTML is not the best idea, I would recommend going for CSS Selector Extractor instead, the relevant configuration would be as simple as:

  • Selector: input[name=formToken]
  • Attribute: value

Demo:

enter image description here

More information: How to Use the CSS/JQuery Extractor in JMeter

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I've read of performance considerations when using CSS Extractor, do you reckon the impact is negligible? – Tinashe Chinyanga Jul 25 '21 at 13:32
  • Try copying your response data into a [Dummy Sampler](https://www.blazemeter.com/blog/jmeters-dummy-sampler-the-ultimate-guide/), set connect time, latency and response time to 0 and perform 2 tests, one with Regular Expression Extractor and another one with CSS Selector Extractor. Compare the throughput/number of samples using [Summary Report](https://jmeter.apache.org/usermanual/component_reference.html#Summary_Report) listener or equivalent. The one which have more throughput will have better performance. – Dmitri T Jul 25 '21 at 14:38
  • Thanks for the above @dmitri. Will give this a short and let you know. – Tinashe Chinyanga Jul 27 '21 at 19:06
0

Try with the following Regex:

value="(.+?)"