一、清楚內(nèi)容中的Javsscript 代碼
復(fù)制代碼 代碼如下:
Function ClearJSCode(originCode)
Dim reg
set reg = New RegExp
reg.Pattern = "<SCRIPT[^<]*</SCRIPT>"
reg.IgnoreCase = True
reg.Global = True
clearJSCode = reg.Replace(originCode, "")
End Function
二、清除內(nèi)容中的HTML代碼
復(fù)制代碼 代碼如下:
Function ClearHTMLCode(originCode)
Dim reg
set reg = new RegExp
reg.Pattern = "<[^>]*>"
reg.IgnoreCase = True
reg.Global = True
ClearHTMLCode = reg.Replace(originCode, "")
End Function
現(xiàn)在好多網(wǎng)站的內(nèi)容都是使用采集程序生成的,使用上邊的代碼就可以輕松的將內(nèi)容中的HTML和JS代碼清除掉。