我需要在表格/ td/tr/th标签中更改宽度和高度属性的所有发生的样式。PHP - 正则表达式,用于转换样式中的宽度/高度属性
例如,
<table width="500" height="235" style="color:#FF0000;">
<tr>
<td width="30" height="25" style="color:#FFFF00;">Hello</td>
<td>World</td>
</tr>
</table>
应该成为
<table style="color:#FF0000;width:500px;height:235px">
<tr>
<td style="color:#FFFF00;width:30px;height:25px">Hello</td>
<td>World</td>
</tr>
</table>
我该怎么办呢?
[不可使用正则表达式染指(X)HTML] (http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – 2011-02-10 15:13:50
`style =“red”`是主要的废话。请清理你的示例代码。 – ThiefMaster 2011-02-10 15:13:52