ASP common Regular Expressions implement string substitution _ regular expressions

Source: Internet
Author: User
Tags html tags
Get rid of HTML tags regular <\/*[^<>]*>
Function losehtml (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "<\/*[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Set RegEx = Nothing
losehtml = Clstemplosestr
End Function
Get rid of class in a Web page
Function Loseclasstag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "(class=) {1,} (" |\ ') {0,1}\s+ ("|\ ' |>|\s) {0,1}"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Loseclasstag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losescripttag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "(<script) {1,}[^<>]*>[^\0]* (<\/script>) {1,}"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losescripttag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Loseiframetag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "(<iframe) {1,}[^<>]*>[^\0]* (<\/iframe>) {1,}"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Loseiframetag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Loseobjecttag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "(<object) {1,}[^<>]*>[^\0]* (<\/object>) {1,}"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Loseobjecttag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losespantag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}span[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losespantag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losefonttag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}font[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losefonttag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Loseatag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}a[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Loseatag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losedivtag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}div[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losedivtag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losestyletag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "(<style) {1,}[^<>]*>[^\0]* (<\/style>) {1,}"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losestyletag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losenotetag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "<!--\/*[^<>]*-->"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losenotetag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losetabletag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}table[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losetabletag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losetdtag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}td[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losetdtag = Clstemplosestr
Set RegEx = Nothing
End Function

Function Losetrtag (CONTENTSTR)
Dim Clstemplosestr,regex
Clstemplosestr = Cstr (CONTENTSTR)
Set RegEx = New RegExp
Regex.pattern = "< (\/) {0,1}tr[^<>]*>"
Regex.ignorecase = True
Regex.global = True
Clstemplosestr = Regex.Replace (Clstemplosestr, "")
Losetrtag = Clstemplosestr
Set RegEx = Nothing
End function
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.