Remove all tags in HTML code
Copy Code code as follows:
<%
'******************************
' Function: Removehtml_a (strText)
' Parameters: StrText, strings to be processed
' Author: Arisisi
' Date: 2007/7/12
' Description: Remove all tags from HTML code
' Example: <%=removehtml_a ("<b> Welcome Arisisi </b>")%>
'******************************
Function removehtml_a (StrText)
Dim NPOS1
Dim NPos2
NPOS1 = InStr (StrText, "<")
Do While npos1>0
NPos2 = InStr (npos1+1, StrText, ">")
If npos2>0 Then
StrText = Left (StrText, npos1-1) & Mid (StrText, NPos2 + 1)
Else
Exit do
End If
NPOS1 = InStr (StrText, "<")
Loop
Removehtml_a = StrText
End Function
%>
Remove all tags in html code two
Copy Code code as follows:
<%
'******************************
' Function: Removehtml_b (strText)
' Parameters: StrText, strings to be processed
' Author: Arisisi
' Date: 2007/7/12
' Description: Remove all tags from HTML code
' Example: <%=removehtml_b ("<b> Welcome Arisisi </b>")%>
'******************************
Function Removehtml_b (StrText)
Dim RegEx
Set RegEx = New RegExp
Regex.pattern = "<[^>]*>"
Regex.global = True
Removehtml_b = Regex.Replace (StrText, "")
End Function
%>
Remove all tags in HTML code three
Copy Code code as follows:
<%
'******************************
' Function: Removehtml_c (strText)
' Parameters: StrText, strings to be processed
' Author: Arisisi
' Date: 2007/7/12
' Description: Remove all tags from HTML code
' Example: <%=removehtml_c ("<b> Welcome Arisisi </b>")%>
'******************************
Function Removehtml_c (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
Removehtml_c = Strresult
End Function
%>