1、函数是用来处理输入是否是非法
Function CheckStringByRegEx(strValue, RegPattern)
Dim regEx
Dim bRight
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = RegPattern
bRight = regEx.Test(strValue)
Set regEx = Nothing
CheckStringByRegEx = bRight
End Function
2、Request处理收到的需要识别是数字的参数
Function GetVaildNum(nNum)
Dim nNumOnError
nNumOnError = 0
If nNum = "" Or IsEmpty(nNum) Then
nNum = nNumOnError
Else
If Not IsNumeric(nNum) Then
nNum = nNumOnError
Else
nNum = CDbl(nNum)
If nNum > 214748367 Or nNum < 0 Then
nNum = nNumOnError
End If
End If
End If
GetVaildNum = nNum
End Function
CheckStringByRegEx("smallqiang","^[\w]{3,20}$")
使用的方式 |