0
我想清理一個cms數據庫:所有的內容都有內聯樣式,我需要去掉它們。正則表達式模式不能在特定情況下工作
我有很多嵌套標記,所以我試圖用<h3>
(我確定標題沒有嵌套)替換<span>
標記,然後用HTMLPurifier清理其他標記。
我寫這符合<h3>
更換<span>
標籤:
$string = preg_replace('/<span style="line-height: 17pt; font-family: helvetica; color: rgb\(85, 85, 85\); font-size: 13pt; font-weight: bold;">(.*?)<\/span>/', '<h3>$1</h3>',$string);
它可以在任何情況下exept此:
<span style="line-height: 17pt; font-family: helvetica; color: rgb(85, 85, 85); font-size: 13pt; font-weight: bold;">"Rischio obsolescenza" per i lettori Blu-ray</span>
也許「的文字是問題
我該如何解決這個問題?