I need help with my js regex code.
The text:
9.The average American walks 3,000 to 4,000 steps a day.
From inspect element:
<h3 id="the-average-american-walks-3000-to-4000-steps-a-day">
<span>9.</span> The average American walks 3,000 to 4,000 steps a day.
</h3>
My output:
The average American walks 3,to 4,steps a day.
Expected output:
The average American walks 3,000 to 4,000 steps a day.
My code:
$(".round-number")
.find("h3")
.each(function (i, el) {
let row = $(el).text().replace(/(\s+)/g, " ");
row = $(el)
.text()
.replace(/[0-9]+. /g, "")
.trim();
console.log(`${row}`);
healthArray.push(row);
});