Regular | regular <%
Rem # Simple regular checks to see if illegal characters are included
Rem # str string to be detected
Rem # Badwordlist filtered strings, must be | Apart
function Ishavebadword (str, badwordlist)
Dim Strpattern
Strpattern = badwordlist & "+"
Dim Oregex, Omatch
Set Oregex = New RegExp
Oregex.ignorecase = True ' is 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 # Simple regular replaces illegal characters with a * instead
Rem # str string to be detected
Rem # Badwordlist filtered strings, must be | Apart
function Replacebadword (str, badwordlist)
Dim Strpattern
Strpattern = badwordlist & "+"
Dim Oregex, Omatch
Set Oregex = New RegExp
Oregex.ignorecase = True ' is case-insensitive
Oregex.global = True
Oregex.pattern = Strpattern
Replacebadword = Oregex.replace (str, "*")
Set Oregex = Nothing
End Function
Response. Write ("ASP Xiao Month Mark Xiaoyuehen" & Ishavebadword ("ASP Xiao Month mark Xiaoyuehen", "xiaoyuehen| Xiao Month mark") & "<br>")
Response. Write ("ASP Xiao Month Mark Xiaoyuehen" & Replacebadword ("ASP Xiao Month mark Xiaoyuehen", "xiaoyuehen| Xiao Month mark") & "<br>")
Rem # Detects whether a sequence of digits is separated. Multiple-selection commit detection available for forms
Rem # str string to be detected
function Matchnumlist (str)
Dim Strpattern
Strpattern = "^[0-9]{1,} (, [0-9]+) {0,}$"
Dim Oregex, Omatch
Set Oregex = New RegExp
Oregex.ignorecase = True ' is 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 ("6,1245,2122,456" & Matchnumlist ("6,1245,2122,456") & "<br>")
Response. Write ("6,1a45,2122,456" & Matchnumlist ("6,1a45,2122,456") & "<br>")
Response. Write (", 6,1245,2122,456" & Matchnumlist (", 6,1245,2122,456") & "<br>")
Response. Write ("6,1245,2122,456," & Matchnumlist ("6,1245,2122,456,") & "<br>")
%>