HTML Table Scraping using REGEX

In this demo we will extract a HTML table from a web page and export the data in CSV format.

Step 1 : Create a new web scraping agent and name it "HTML_Table_extraction".

Step 2 : Now we will review the HTML source code.

<!DOCTYPE html>
table, th, td {border: 1px solid black;border-collapse: collapse;}th, td {padding: 15px;}</style>
<h1>HTML Table Extraction</h1>
<table style="width:60%">


Step 3 :  Now we will analyze the html source code and write unique REGEX to match the pattern of item we need to extract.

You can use the built-in REGEX tester tool to test pattern or any other regex tester tool of your choice.

I'm using Rubular online tool to write and test the regex and found below regular expression worked for this table.


Now just paste this regex in new web scraping agent for each COLUMN1, COLUMN2, COLUMN3 and change the item# as 1,2,3 for corresponding column

The Item number in this setup grid is the position of item in REGEX

Step 4 : Click on Save to create.

Step 5 : Right click and excute this agent.

Close me