Saturday 18 August 2018

Jmeter - Capture multi-line(more than one line) value using regular expression extractor.

In case, you are familiar with any load testing tool, you must be aware of the correlation concept. The soul purpose of correlation is similar in all the tools; however, the implementation is somewhat different. In load runner, we have web_reg_save_param() function which requires left bound and right bound. Load runner also provides an option to use regular expressions to fetch values. Whereas, in Jmeter, we have an element "Regular expression extractor"  which can be used to extract data.

Creating a regular expression when one has to fetch data from a single line is somehow easy. However, it gets tricky when multiline values have to be extracted.

Solution - You need to use (?ms) before your regular expression in order to match multi-line values. Here, ms means multi select.

Go through the below example for more details.

Text to select


Using normal regular expression


Using multi-select