时间: 2021-07-31 作者:daque
匹配html标记的正则<textarea id="htmlcode" rows="5" cols="50"><namespace:span id="1\">'>" name=spanname /><span id="2"> <span id="3" /><span id="4"><span></span></span><span id="6" /><div></div></span><div><div></div></div><span id="5"></span></textarea><br /><script>function htmltag(){re=/<(\/\s*)?((\w+:)?\w+)(\w+(\s*=\s*((["'])(\\["'tbnr]|[^\7])*?\7|\w+)|.{0})|\s)*?(\/\s*)?>/igreturn htmlcode.value.match(re)}</script><button onclick="alert(htmltag().join('\n------------------------------------\n'))">配合</button> [ctrl+a 十足采用 提醒:你可先窜改局部代码,再按运转]