1
我需要一個正則表達式,它將處理在文本編輯器中輸入的文本的格式。格式化HTML數據在客戶端使用jQuery/javascript
見這個網站
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-pagination:none;mso-layout-grid-align:none;text-autospace:none;text-align:center;"><b><span style="font- size:14.0pt;font-family:"Times-Roman","serif";mso-bidi-font-family:
Times-Roman;color:#1B1E20">-- Michael Hirst</span></b><span style="font-size:
14.0pt;font-family:"Times-Roman","serif";mso-bidi-font-family:Times-Roman;
color:#1B1E20">, creator, writer, and executive producer, Vikings</span><o:p></o:p></p>
預期輸出:
<p style="text-align:center;"><span>--Michael Hirst</span></b><span>creator, writer, and executive producer,Vikings</span>
我需要刪除類從HTML屬性。和我需要的內聯樣式除了只有文本對齊。 格式化這個後,我需要在PHP僅像我們做,除非一些標籤使用strip_tags的
strip_tags($html,"<b><h2><h3><h4><strong><div><p><br><ul><li><ol><blockquote>")
這將是這樣做的正則表達式。我是這個正則表達式的新手!
查看數據從文本編輯器來了。而且它總是不能在那裏存在。可以有任何格式。我只想格式化它。正如我在我的問題中提到的那樣。這是關於格式化HTML。 –
@Creator如果HTML數據只是在文本編輯器中如何使用JavaScript或jQuery幫助解決問題? – garyh
當用戶發佈它。我可以抓住他的輸入並在客戶端格式化並傳遞到服務器端。 @garyh –