Several simple regular expressions (Asp, constantly updating ...)

Source: Internet
Author: User
<% REM # check whether a simple regular expression contains invalid characters REM # STR string to be detected REM # The badwordlist-filtered string must be separated by the | function ishavebadword (STR, badwordlist) dim strpattern = badwordlist & "+" dim oregex, omatch set oregex = new Regexp oregex. ignorecase = true' case-insensitive oregex. global = true oregex. pattern = strpattern set omatch = oregex. execute (STR) If omatch. count then ishavebadword = true else ishavebadword = false end if end function REM # Replace invalid characters with simple regular expressions, use a * to replace the REM # STR string to be detected REM # badwordlist to filter the string, which must be separated by a function replacebadword (STR, badwordlist) dim strpattern = badwordlist & "+" dim oregex, omatch set oregex = new Regexp oregex. ignorecase = true' case-insensitive oregex. global = true oregex. pattern = strpattern replacebadword = oregex. replace (STR, "*") set oregex = nothing end function response. write ("ASP Xiao Yue mark xiaoyuehen" & ishavebadword ("ASP Xiao Yue mark xiaoyuehen", "xiaoyuehen | Xiao Yue mark") & "<br>") response. write ("ASP Xiao Yue mark xiaoyuehen" & replacebadword ("ASP Xiao Yue mark xiaoyuehen", "xiaoyuehen | Xiao Yue mark") & "<br> ") rem # check whether it is a digital sequence separated by digits. multiple-choice submission of forms detection REM # STR string to be detected function matchnumlist (STR) dim strpattern = "^ [0-9] {1 ,}(, [0-9] +) {0,} ___ fckpd ___ 0 quot; dim oregex, omatch set oregex = new Regexp oregex. ignorecase = true' case-insensitive oregex. global = true oregex. pattern = strpattern set omatch = oregex. execute (STR) If omatch. count then matchnumlist = true else matchnumlist = false end if end function response. write ("2122,456, 2122,456" & matchnumlist (",") & "<br>") response. write ("6, 1a45, 2122,456" & matchnumlist ("6, 1a45, 2122,456") & "<br>") response. write (", 2122,456, 2122,456" & matchnumlist (",") & "<br>") response. write ("2122,456, 2122,456," & matchnumlist (",") & "<br>") %>

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.