存成.asp文件,执行,你用ASPHTTP抓内容的时候用这个很爽,当然自己要改进一下了
1
2Option Explicit
3
4Function stripHTML(strHTML)
5'Strips the HTML tags from strHTML
6
7Dim objRegExp, strOutput
8Set objRegExp = New Regexp
9
10objRegExp.IgnoreCase = True
11objRegExp.Global = True
12objRegExp.Pattern = "<.+?>"
13
14'Replace all HTML tag matches with the empty string
15strOutput = objRegExp.Replace(strHTML, "")
16
17'Replace all < and > with < and >
18strOutput = Replace(strOutput, "<", "<")
19strOutput = Replace(strOutput, ">", ">")
20
21stripHTML = strOutput 'Return the value of strOutput
22
23Set objRegExp = Nothing
24End Function
25
26
1<form id="form1" method="post" name="form1">
2<b>Enter an HTML String:</b><br/>
3<textarea cols="50" name="txtHTML" rows="8" wrap="virtual">```
4=Request("txtHTML")
5```</textarea>
6<p>
7<input id="submit1" name="submit1" type="submit" value="Strip HTML Tags!"/>
8</p></form>
1 if Len(Request("txtHTML")) > 0 then
1<p><hr/><p>
2<b><u>View of string <i>with no</i> HTML stripping:</u></b><br/>
3<xmp>
=Request("txtHTML")
1</xmp><p>
2<b><u>View of string <i>with</i> HTML stripping:</u></b><br/>
3<pre>
=StripHTML(Request("txtHTML"))
1</pre>
End If