Asp学习站欢迎你!

输入验证类Validator

来源:ASP学习网 作者:Admin 时间:08-04-24 点击:

输入验证类Validator:
<%@Language="VBScript" CodePage="936"%>
<%
''Option Explicit
Class Validator
''*************************************************
'' Validator for ASP beta 3 服务器端脚本
'' code by 我佛山人
'' wfsr@cunite.com
''*************************************************
Private Re
Private ICodeName
Private ICodeSessionName

Public Property Let CodeName(ByVal PCodeName)
ICodeName = PCodeName
End Property

Public Property Get CodeName()
CodeName = ICodeName
End Property

Public Property Let CodeSessionName(ByVal PCodeSessionName)
ICodeSessionName = PCodeSessionName
End Property

Public Property Get CodeSessionName()
CodeSessionName = ICodeSessionName
End Property

Private Sub Class_Initialize()
Set Re = New RegExp
Re.IgnoreCase = True
Re.Global = True
Me.CodeName = "vCode"
Me.CodeSessionName = "vCode"
End Sub

Private Sub Class_Terminate()
Set Re = Nothing
End Sub

Public Function IsEmail(ByVal Str)
IsEmail = Test("^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*contentquot;, Str)
End Function

Public Function IsUrl(ByVal Str)
IsUrl = Test("^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\'':+!]*([^<>""])*contentquot;, Str)
End Function

Public Function IsNum(ByVal Str)
IsNum= Test("^\d+contentquot;, Str)
End Function

Public Function IsQQ(ByVal Str)
IsQQ = Test("^[1-9]\d{4,8}contentquot;, Str)
End Function

Public Function IsZip(ByVal Str)
IsZip = Test("^[1-9]\d{5}contentquot;, Str)
End Function

Public Function IsIdCard(ByVal Str)
IsIdCard = Test("^\d{15}(\d{2}[A-Za-z0-9])?contentquot;, Str)
End Function

Public Function IsChinese(ByVal Str)
IsChinese = Test("^[\u0391-\uFFE5]+contentquot;, Str)
End Function

Public Function IsEnglish(ByVal Str)
IsEnglish = Test("^[A-Za-z]+contentquot;, Str)
End Function

Public Function IsMobile(ByVal Str)
IsMobile = Test("^((\(\d{3}\))|(\d{3}\-))?13\d{9}contentquot;, Str)
End

标签: 】 【打印】 【关闭
上一篇:分页类Pager
下一篇:文件加密
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 验证码: 验证码 查看所有评论