如何使用正則表達式從HTML字符串中排除樣式屬性?使用正則表達式反轉匹配
例如,如果我們有如下內嵌HTML字符串:
<html><body style="background-color:yellow"><h2 style="background-color:red">This is a heading</h2><p style="background-color:green">This is a paragraph.</p></body></html>
當應用正則表達式匹配,匹配的結果應該是這樣的:
<html><body ><h2 >This is a heading</h2><p >This is a paragraph.</p></body></html>