ASP filters the regular code for all content within the angle brackets _ Application Tips

Source: Internet
Author: User

Of course this should be a normal filtering technique, and there is a final pole of filtering HTML tags, it is a pair of angle brackets and all the words in the angle brackets enclosed replace not display, the method for the content must describe the content of the angle bracket filter too far.
However, there is always a need to replace all the angle brackets all the time, it is obvious that the need for regular, there are two types of code, the first one is as follows:

Copy Code code as follows:

Function nohtml (str)
Dim re
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "(\<.[ ^\<]*\>) "
Str=re.replace (str, "")
Re. Pattern= "(\<\/[^\<]*\>)"
Str=re.replace (str, "")
Nohtml=str
Set re=nothing
End Function

The second type:
Copy Code code as follows:

Function nohtml (str)
Dim re
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "< (. [ ^>]*) > "
Str=re.replace (str, "")
Nohtml=str
Set re=nothing
End Function

Simple application:
<script language= "vbs" > Function nohtml (str) Dim re Set re=new RegExp re. IgnoreCase =true Re. Global=true Re. Pattern= "< (. [ ^>]*) > "Str=re.replace (str," ") Nohtml=str set re=nothing end Function alert (nohtml > Cloud-dwelling community ") </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.