js常用(10)
Case "Truename" '英文姓名
patrn="^[a-zA-Z]{1,30}$"
Case "Passwd" '密码
patrn="^(\w){6,20}$"
Case "Tel" '电话/传真
patrn="^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$"
Case "Mobil" '手机
patrn="^(\d)+[-]?(\d){6,12}$"
Case "Date" '日期(格式:yyyy-mm-dd)
patrn="^[12]{1}(\d){3}[-][01]?(\d){1}[-][0123]?(\d){1}$"
Case "Email" '电子邮件
patrn="^((\w)|[-]|[.])+@(((\w)|[-])+[.])+[a-z]{2,4}$"
Case "Postalcode" '邮政编码
patrn="^[a-z0-9 ]{3,12}$"
Case "Search" '搜索关键字
patrn="^[^`~!@#$%^&*()+=|\\\[\]\{\}:;\'\,.<>/?]{1}[^`~!@$%^&()+=|\\\[\]\{\}:;\'\,.<>?]{0,19}$"
Case "Int" '整数
patrn="^[1-9]{1}[0-9]{0,6}$"
Case "Array"
patrn="^[0-9]{1}([0-9]|[\,]){0,150}$"
End Select
Dim regEx
Dim Match
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Matches = regEx.test(strng)
IsVerify = Matches
Set regEx = Nothing
End Function
'********************************************
'函数功能:对输入框的特殊字串进行过滤保存
'参数strPass:过滤前的字符串
'返回值:过滤后的字符串
'********************************************
Function SQLencode(byVal strPass)
strPass = Replace(strPass, "&", "&")
strPass = Replace(strPass, "<", "<")
strPass = Replace(strPass, ">", ">")
strPass = Replace(strPass, """", """)
strPass = Replace(strPass, "'", "'")
strPass = Replace(strPass, " ", " ")
strPass = Replace(strPass,chr(13)&chr(10),"<br/>")
SQLencode = strPass
End Function
'********************************************
'函数功能:对SQLencode函数过滤后的字符串进行还原
'参数strPass:经过过滤后的字符串
'返回值:还原的过滤前的字符串
'********************************************
Function SQLdecode(byVal strPass)
If Not isNull(strPass) Then
strPass = Replace(strPass, "<", "<")
strPass = Replace(strPass, ">", ">")
strPass = Replace(strPass, ""","""" )
strPass = Replace(strPass, "'","'" )
strPass = Replace(strPass,"<br/>",chr(13)&chr(10))
End If
SQLdecode = strPass
End Function
'********************************************
'函数功能:生成随机密码(字符为数字与大小写字母集合)
'参数length:密码长度
'返回值:随机密码
'********************************************
相关新闻>>
- 发表评论
-
- 最新评论 更多>>