// js 正则只替换img标签中style const html = '<img src="image.jpg" style="width:100px;height:100px;">'; const newHtml = html.replace(/(<img[^>]*style=")(.*?)("[^>]*>)/g, (match, p1, p2, p3) => { return p1 + 'new-style-value;' + p3; }); console.log(newHtml); // 输出 <img src="image.jpg" style=
2026-01-12 08:32:24