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

2

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.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay