复制代码 代码如下:
'==============================
'功能描述: 用正则除去HTML标记
'不能保留<b><strong>等以及用户自定义的<和>
'==============================
Function RemoveHTMLTag(fString)
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Pattern = "<(.[^>]*)>"
fString = re.Replace(fString, "")
Set re = Nothing
RemoveHTMLTag = fString
End Function
'==============================
'功能描述: 除去HTML标记
'不能保留<b><strong>等以及用户自定义的<和>
'==============================
Function Remove_HTML(Str)
Dim ilen1, ilen2
Do While InStr(1, Str, "<", 1) >0
ilen1 = InStr(1, Str, "<", 1)
ilen2 = InStr(1, Str, ">", 1)
Str = Left(Str, ilen1 -1) & Mid(Str, ilen2 + 1)
Loop
Remove_HTML = Str
End Function
'==============================
'功能描述: 除去HTML标记
'去除自定义的标记,速度可能有点慢
'==============================
Function RemoveHTML(strText)
Dim TAGLIST
TAGLIST = ";!--;!DOCTYPE;A;ACRONYM;ADDRESS;APPLET;AREA;B;BASE;BASEFONT;" &_
"BGSOUND;BIG;BLOCKQUOTE;BODY;BR;BUTTON;CAPTION;CENTER;CITE;CODE;" &_
"COL;COLGROUP;COMMENT;DD;DEL;DFN;DIR;DIV;DL;DT;EM;EMBED;FIELDSET;" &_
"FONT;FORM;FRAME;FRAMESET;HEAD;H1;H2;H3;H4;H5;H6;HR;HTML;I;IFRAME;IMG;" &_
"INPUT;INS;ISINDEX;KBD;LABEL;LAYER;LAGEND;LI;LINK;LISTING;MAP;MARQUEE;" &_
"MENU;META;NOBR;NOFRAMES;NOSCRIPT;OBJECT;OL;OPTION;P;PARAM;PLAINTEXT;" &_
内容版权声明:除非注明,否则皆为本站原创文章。