<% Function RemoveHTML(strHTML)'過濾HTML代碼的(de)函數包括過濾CSS和(hé)JSStrHtml = Replace(StrHtml,vbCrLf,"") StrHtml = Replace(StrHtml,Chr(13)
<% Function RemoveHTML(strHTML) '過濾HTML代碼的(de)函數包括過濾CSS和(hé)JS StrHtml = Replace(StrHtml,vbCrLf,"") StrHtml = Replace(StrHtml,Chr(13)&Chr(10),"") StrHtml = Replace(StrHtml,Chr(13),"") StrHtml = Replace(StrHtml,Chr(10),"") StrHtml = Replace(StrHtml," ","") StrHtml = Replace(StrHtml," ","") Dim objRegExp, Match, Matches Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True '取閉合的(de)<> objRegExp.Pattern = "<style(.+?)/style>" '進行匹配 Set Matches = objRegExp.Execute(strHTML) ' 遍曆匹配集合,并替換掉匹配的(de)項目 For Each Match in Matches strHtml=Replace(strHTML,Match.Value,"") Next '取閉合的(de)<> objRegExp.Pattern = "<script(.+?)/script>" '進行匹配 Set Matches = objRegExp.Execute(strHTML) ' 遍曆匹配集合,并替換掉匹配的(de)項目 For Each Match in Matches strHtml=Replace(strHTML,Match.Value,"") Next '取閉合的(de)<> objRegExp.Pattern = "<.+?>" '進行匹配 Set Matches = objRegExp.Execute(strHTML) ' 遍曆匹配集合,并替換掉匹配的(de)項目 For Each Match in Matches strHtml=Replace(strHTML,Match.Value,"") Next RemoveHTML=strHTML Set objRegExp = Nothing End Function %>