const tableText = `
Name Age City
John 30 New York
Jane 25 Los Angeles
Bob 40 Chicago
`; // Extract the row data from the table text using regular expressions const rowData = tableText.match(/(.*?)<\/tr>/gs).map(tr => { const cellData = tr.match(/(.*?)<\/td>/gs).map(td => td.replace(/<\/?td>/g, '')); return { Name: cellData[0], Age: cellData[1], City: cellData[2] }; }); // Log the resulting JSON object console.log(JSON.stringify(rowData));