复制代码 代码如下:
'==============================
'功能描述: 用正则除去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;" &_
"PRE;Q;S;SAMP;SCRIPT;Select;SMALL;SPAN;STRIKE;STRONG;STYLE;SUB;SUP;" &_
"TABLE;TBODY;TD;TEXTAREA;TFOOT;TH;THEAD;TITLE;TR;TT;U;UL;VAR;WBR;XMP;"
Const BLOCKTAGLIST = ";APPLET;EMBED;FRAMESET;HEAD;NOFRAMES;NOSCRIPT;OBJECT;SCRIPT;STYLE;"
Dim nPos1
Dim nPos2
Dim nPos3
Dim strResult
Dim strTagName
Dim bRemove
Dim bSearchForBlock
nPos1 = InStr(strText, "<")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strTagName = Mid(strText, nPos1 + 1, nPos2 - nPos1 - 1)
strTagName = Replace(Replace(strTagName, vbCr, " "), vbLf, " ")
nPos3 = InStr(strTagName, " ")
If nPos3 > 0 Then
strTagName = Left(strTagName, nPos3 - 1)
End If
If Left(strTagName, 1) = "/" Then
strTagName = Mid(strTagName, 2)
bSearchForBlock = False
Else
bSearchForBlock = True
End If
If InStr(1, TAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
bRemove = True
If bSearchForBlock Then
If InStr(1, BLOCKTAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
nPos2 = Len(strText)
nPos3 = InStr(nPos1 + 1, strText, "</" & strTagName, vbTextCompare)
If nPos3 > 0 Then
nPos3 = InStr(nPos3 + 1, strText, ">")
End If
If nPos3 > 0 Then
nPos2 = nPos3
End If
End If
End If
Else
bRemove = False
End If
If bRemove Then
strResult = strResult & Left(strText, nPos1 - 1)
strText = Mid(strText, nPos2 + 1)
Else
strResult = strResult & Left(strText, nPos1)
strText = Mid(strText, nPos1 + 1)
End If
Else
strResult = strResult & strText
strText = ""
End If
nPos1 = InStr(strText, "<")
Loop
strResult = strResult & strText
strResult = Replace(strResult, Chr(9), "")
strResult = Replace(strResult, Chr(32), "")
strResult = Replace(strResult, Chr(13), "")
strResult = Replace(strResult, Chr(10), "")
strResult = Replace(strResult, vbCrLf, "")
RemoveHTML = strResult
End Function
'==============================
'功能描述: 用正则除去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;" &_
"PRE;Q;S;SAMP;SCRIPT;Select;SMALL;SPAN;STRIKE;STRONG;STYLE;SUB;SUP;" &_
"TABLE;TBODY;TD;TEXTAREA;TFOOT;TH;THEAD;TITLE;TR;TT;U;UL;VAR;WBR;XMP;"
Const BLOCKTAGLIST = ";APPLET;EMBED;FRAMESET;HEAD;NOFRAMES;NOSCRIPT;OBJECT;SCRIPT;STYLE;"
Dim nPos1
Dim nPos2
Dim nPos3
Dim strResult
Dim strTagName
Dim bRemove
Dim bSearchForBlock
nPos1 = InStr(strText, "<")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strTagName = Mid(strText, nPos1 + 1, nPos2 - nPos1 - 1)
strTagName = Replace(Replace(strTagName, vbCr, " "), vbLf, " ")
nPos3 = InStr(strTagName, " ")
If nPos3 > 0 Then
strTagName = Left(strTagName, nPos3 - 1)
End If
If Left(strTagName, 1) = "/" Then
strTagName = Mid(strTagName, 2)
bSearchForBlock = False
Else
bSearchForBlock = True
End If
If InStr(1, TAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
bRemove = True
If bSearchForBlock Then
If InStr(1, BLOCKTAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
nPos2 = Len(strText)
nPos3 = InStr(nPos1 + 1, strText, "</" & strTagName, vbTextCompare)
If nPos3 > 0 Then
nPos3 = InStr(nPos3 + 1, strText, ">")
End If
If nPos3 > 0 Then
nPos2 = nPos3
End If
End If
End If
Else
bRemove = False
End If
If bRemove Then
strResult = strResult & Left(strText, nPos1 - 1)
strText = Mid(strText, nPos2 + 1)
Else
strResult = strResult & Left(strText, nPos1)
strText = Mid(strText, nPos1 + 1)
End If
Else
strResult = strResult & strText
strText = ""
End If
nPos1 = InStr(strText, "<")
Loop
strResult = strResult & strText
strResult = Replace(strResult, Chr(9), "")
strResult = Replace(strResult, Chr(32), "")
strResult = Replace(strResult, Chr(13), "")
strResult = Replace(strResult, Chr(10), "")
strResult = Replace(strResult, vbCrLf, "")
RemoveHTML = strResult
End Function
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
更新日志
2024年11月20日
2024年11月20日
- 群星《2024好听新歌38》AI调整音效【WAV分轨】
- 台湾荷东《周末狂热1》[WAV+CUE][1.1G]
- 群星《Hi.Fi.怀旧金曲.Vol.1》[低速原抓WAV+分轨][996M]
- 汪峰 白金超精选《生来彷徨2CD》[WAV+CUE][1.5G]
- 孙露《寂寞撩人》限量1:1母盘直刻低速原抓[WAV+CUE]
- 20世纪伟大的钢琴家《盖扎·安达》2CD[WAV分轨]
- 龚玥《微风拂面HQCD》[低速原抓WAV+CUE]
- 群星《新说唱2024 第12期 (上)》[320K/MP3][117.13MB]
- 群星《新说唱2024 第12期 (上)》[FLAC/分轨][626.34MB]
- 彦希《Golden Blue》[320K/MP3][111.78MB]
- 中岛美雪《美雪集原曲流行极品》[正版原抓WAV+CUE]
- 【古典音乐】《最优美的格里格音乐作品》2CD[FLAC+CUE/整轨]
- 中央乐团《春芽(63首世界名曲联奏)》APE
- 彦希《Golden Blue》[FLAC/分轨][587.25MB]
- 群星《我们的歌第六季 第1期》[320K/MP3][90.72MB]