it may be more complicated to use regularity. Add this html directly to a dom node, obtain attributes through the dom node generated by variables, and convert it into a json object


.

realized with the idea of upstairs:

4</span>
</span>

`; let div = document.createElement('div'); div.innerHTML = html; function getData(node, data) { if (!Array.isArray(data)) { throw TypeError('data is not Array'); } if (node.hasChildNodes()) { node.childNodes.forEach(element => { if (element.nodeType === 1) { // getData(element, data); // } if (element.nodeType === 3) { // const text = element.nodeValue; if (!text.match(/^\s*$/g)) { // const style = element.parentNode.style; // data.push({ text: text.trim(), color: style.color, font_size: style.fontSize, }); } } }); } } let data = []; getData(div, data); console.log(data);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e544ae-45290.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e544ae-45290.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?