[英]Remove white space from entire Html but inside pre with regular expressions in php
我使用在此發現了以下的正則表達式交 :(?<= \\ S)(?![^ <>] *)\\ S +
當我這樣做時:
echo gzencode( trim( preg_replace('/(?<=\s)\s+(?![^<>]*<\/pre>)/', '', $html) ), 9);
所有html中的空格均被替換。 即使在預標簽內。 我需要它來壓縮整個頁面。
嘗試這個:
echo gzencode( trim( preg_replace('/\s+(?![^<>]*<\/pre>)/', '', $html) ), 9);
=)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.