Another more powerful function is also written using a regular expression, but something is added.

Source: Internet
Author: User

<%
Option Explicit
Function stripHTML (strtext)
Dim arysplit, I, j, strOutput
Arysplit = split (strtext, "<")

If len (arysplit (0)> 0 then j = 1 else j = 0
For I = j to ubound (arysplit)
If instr (arysplit (I), ">") then
Arysplit (I) = mid (arysplit (I), instr (arysplit (I), ">") + 1)
Else
Arysplit (I) = "<" & arysplit (I)
End if
Next
StrOutput = join (arysplit ,"")
StrOutput = mid (strOutput, 2-j)
StrOutput = replace (strOutput, ">", "> ")
StrOutput = replace (strOutput, "<", "<")
StripHTML = strOutput
End Function
%>
<Form method = "post" id = form1 name = form1>
<B> Enter an HTML String: </B> <br>
<Textarea name = "txtHTML" cols = "50" rows = "8" wrap = "virtual"> <% = Request ("txtHTML") %> </textarea>
<P>
<Input type = "submit" value = "Strip HTML Tags! "Id = submit1 name = submit1>
</Form>
<% If Len (Request ("txtHTML")> 0 then %>
<P> <B> <u> View of string <I> with no </I> HTML stripping: </u> </B> <br>
<Xmp>
<% = Request ("txtHTML") %>
</Xmp> <p>
<B> <u> View of string <I> with </I> HTML stripping: </u> </B> <br>
<Pre>
<% = StripHTML (Request ("txtHTML") %>
</Pre>
<% End If %>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.