通過腳本清空標簽p中的class名和style 原創(chuàng)
原創(chuàng) 更新時間:2006年10月25日 00:00:00 原創(chuàng) 作者:
復(fù)制代碼 代碼如下:
<textarea name=jb51 cols=60 rows=6>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 0.05pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文本文本文本。</SPAN></p>
</textarea><button onclick=alert(ubb(jb51.value))>alert</button>
<script>
function ubb(str)
{ var strout;
var re=/<p[\s\S]*?><span[\s\S]*?>(.*?)<\/span><\/p>/gi;
strout=str.replace(re,"<p>$1</p>");
return strout;
}
</script>
相關(guān)文章
用正則表達式批量為a增加target=''''_blank''''新窗口打開的方法
今天在制作模板的時候,發(fā)現(xiàn)一些頁面不是新窗口打開,有時候一些內(nèi)容新窗口打開好些,本來打算手工替換的,發(fā)現(xiàn)了太多,還是正則比較方便一些2013-12-12editplus EmEditor和searchandreplace正則表達式
掌握下面的正則方便我們快速的批量處理文本替換。2009-07-07Javascript lastIndex 正則表達式的一個疑惑
Javascript lastIndex 正則表達式2009-01-01