更新时间:2023-02-21 15:56:08
正则的话,试一下用match,其实也就是要识别到字符串 id="EaezE9)%*e^B{Olq7?Le"
,然后提取出引号里面的字符串
var t = `<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="variables_get" id="EaezE9)%*e^B{Olq7?Le" x="147" y="34"></block>
</xml>`;
var res = t.match(/id\s*="([^"]*)"/);
console.log(res&&res[1])