problem description
in the project, you need to use a rich text editor to edit the text and pass it to the back end.
the front end uses
1 234
1
<span style="color: -sharpE36C09;">2</span>
<span style="font-size: 20px;">3
<span style="font-size: 30px; color: -sharp974806;">4</span>
</span>
but the data needed at the back end is in this format (currently only text, color and font size are needed)
[
{text: "1", color: "", font_size: ""},
{text: "2", color: "-sharpE36C09", font_size: ""}
...
]
is there any elegant way to format this data? At present, the only thing I can think of is regular matching, and the key is that personal regularities are relatively bad, and I can"t write them out.