我有内容:
<table cellpadding="0" cellspacing="0" class="tbl-photo right">
<tbody>
<tr>
<td>
<amp-img layout="responsive" height="500" width="760" alt="" src="https://example.com/uploads/images/0 Богдан-Цырдя(1).jpg" class="i-amphtml-element i-amphtml-layout-responsive i-amphtml-layout-size-defined i-amphtml-layout">
<i-amphtml-sizer style="padding-top: 65.7895%;"></i-amphtml-sizer>
<img decoding="async" alt="" src="https://example.com/uploads/images/0 Богдан-Цырдя(1).jpg" class="i-amphtml-fill-content i-amphtml-replaced-content">
</amp-img>
</td>
</tr>
<tr>
<td class="date"> Foto: example.com</td>
</tr>
</tbody>
</table>
我需要删除这张桌子preg_replace。
我只需要删除这个带有 class 的表tbl-photo right。我怎么能做到这一点?
我的表达:
$pattern = '~<table(?>(?!</?table).)*</table>~is';
$output = preg_replace($pattern, '', $body);
但这会删除所有表格...