0
如果可以的話,我需要一點幫助。 我需要在PHP的正則表達式來移除多個新線和冗餘空格如果出現多於1如何使用Regex刪除多餘的空白?
for example
Hi this is
a
test code
------------------> 轉換以上爲
Hi this is
a
test code
如果可以的話,我需要一點幫助。 我需要在PHP的正則表達式來移除多個新線和冗餘空格如果出現多於1如何使用Regex刪除多餘的空白?
for example
Hi this is
a
test code
------------------> 轉換以上爲
Hi this is
a
test code
用途:
echo preg_replace("/(^\s+|\s+$)/m","\r\n",$text);
編號:鏈接:
How do you trim white space on beginning and the end of each new line with PHP or regex
謝謝你:)你的幫助確實有效.... – user1733984