DEV Community

Cover image for Extract All of Regular-Expression matches from html page using JMeter
Hirok Sarker
Hirok Sarker

Posted on • Originally published at jmeter.apache.org

Extract All of Regular-Expression matches from html page using JMeter

All are well known about JMeter Regular Expression Extractor but today I will share with how to extract all the matches from HTML page and print those value comma(,) separated.

JMeter, the most popular open source performance testing tool, can work with regular expressions, with the Regular Expression Extractor. Regular expressions are a tool used to extract a required part of the text by using advanced manipulations. Regular expressions are popular when testing web applications because they can be used to validate and to perform operations on a response from a web application.

In this article, Iโ€™m going to share how to use extract all of Regular Expression Extractor matches form html in JMeter.

I created a very simple test-plan, look at Figure 1:

Alt Text

Figure 2:
Sampler HTTP Request
Alt Text

Figure 3:
Debug PostProcessor - To check total matchNr and value represent a pattern.
Alt Text

Figure 4:
After extracting ids it will be put to BeanShell PostProcessor
Alt Text

Of course, I cannot cover in one article all possible and impossible cases about using regular expressions. For more information you can refer to JMeter Regular Expressions Tutorial (https://jmeter.apache.org/usermanual/regular_expressions.html) which has exhaustive information.

JMeter uses Jakarta ORO for regular expressions processing. You can quickly test your regular expressions using Jakarta ORO Demonstration (http://jakarta.apache.org/oro/demo.html) Applet which is the fastest way of seeing result matches/groups/etc.

Top comments (0)