我有一些HTML輸出代碼,例如部分:更換標籤和換行符在HTML標籤,其開始在一些文字
<div class="header">
\n\t
<div class="header-inner">
\n\t\t
<div class="title">
Title\n\t\t
</div>
\n\t
</div>
\n
</div>
事業部.title僞有換行符和製表符前關閉。可以刪除它(替換爲JS模式)?文字隨機,並不總是「標題」,和標籤有相同的問題可以很多。
極品:
<div class="header">
\n\t
<div class="header-inner">
\n\t\t
<div class="title">
Title
</div>
\n\t
</div>
\n
</div>
要替換** **所有的製表符和換行符的div.title裏面?可能的重複http://stackoverflow.com/questions/4562756/replacing-tab-characters-in-javascript – roemhildtg
是的,在div.title和所有以文本開頭的標籤中。 – werty1001
我需要regexp進行替換,但我不知道它是否可行,html代碼返回gulp管道,我不能使用jQuery或原生js。 – werty1001