JavaScript clears function code in html text format

Source: Internet
Author: User

JavaScript clears function code in html text format

<%
'/* Function name: Zxj_ReplaceHtml ClearHtml
'/* Function Language: VBScript Language
'/* Usage: Clear the file HTML format Function
'/* Transfer parameter: Content (Note: Content to be cleared)
'/* Function Author: Zhang Xiaojun (Ancient City fairy tale) QQ: 382511147
'/* Function Description: Regular Expression (Regular Expression) mode for data matching and replacement

Function ClearHtml (Content)
Content = Zxj_ReplaceHtml ("& # [^>] *;", "", Content)
Content = Zxj_ReplaceHtml ("</? Marquee [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Object [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Param [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Embed [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Table [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("& nbsp;", "", Content)
Content = Zxj_ReplaceHtml ("</? Tr [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Th [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? P [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? A [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Img [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Tbody [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Li [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Span [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Div [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Th [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Td [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Script [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("(javascript | jscript | vbscript | vbs):", ", Content)
Content = Zxj_ReplaceHtml ("on (mouse | exit | error | click | key)", "", Content)
Content = Zxj_ReplaceHtml ("<\\? Xml [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("<\/? [A-z] +: [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Font [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? B [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? U [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? I [^>] *> "," ", Content)
Content = Zxj_ReplaceHtml ("</? Strong [^>] *> "," ", Content)
ClearHtml = Content
End Function

Function Zxj_ReplaceHtml (patrn, strng, content)
IF IsNull (content) Then
Content = ""
End IF
Set regEx = New RegExp 'to create a regular expression.
RegEx. Pattern = patrn 'setting mode.
RegEx. IgnoreCase = true' is used to set case-insensitive characters.
RegEx. Global = true' to set Global availability.
Zxj_ReplaceHtml = regEx. Replace (content, strng )'
End Function
%>

Usage:

Directly call ClearHtml ()

Related Article

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.