代码例子如下:
- <%
- OptionExplicit
- FunctionstripHTML(strHTML)
- 'StripstheHTMLtagsfromstrHTML
- DimobjRegExp,strOutput
- SetobjRegExp=NewRegexp
- objRegExp.IgnoreCase=True
- objRegExp.Global=True
- objRegExp.Pattern="<.+?>"
- 'ReplaceallHTMLtagmatcheswiththeemptystring
- strOutput=objRegExp.Replace(strHTML,"")
- 'Replaceall<and>with<and>
- strOutput=Replace(strOutput,"<","<")
- strOutput=Replace(strOutput,">",">")
- stripHTML=strOutput'ReturnthevalueofstrOutput
- SetobjRegExp=Nothing
- EndFunction
- %>
- <formmethod="post"id=form1name=form1>
- <b>EnteranHTMLString:</b><br>
- <textareaname="txtHTML"cols="50"rows="8"wrap="virtual"><%=Request("txtHTML")%></textarea>
- <p>
- <inputtype="submit"value="StripHTMLTags!"id=submit1name=submit1>
- </form>
- <%ifLen(Request("txtHTML"))>0then%>
- <p><hr><p>
- <b><u>Viewofstring<i>withno</i>HTMLstripping:</u></b><br>
- <xmp>
- <%=Request("txtHTML")%>
- </xmp><p>
- <b><u>Viewofstring<i>with</i>HTMLstripping:</u></b><br>
- <pre>
- <%=StripHTML(Request("txtHTML"))%>
- </pre>
- <%EndIf%>

