通过以下正则表达式来验证
'================
'验证信息是否合法(常用户注册)
'n--获取类型
's--验证字符
'================
Function g_ExStr(n,s)
IF IsNull(n) or n = "" Then Exit Function
Dim Reg_Ex,Ex_Str
g_ExStr = False
Set Reg_Ex = New RegExp
Select Case n
Case "Aug_Email" '验证邮箱格式
Ex_Str = "^\w+((-\w+)|(.\w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+"
'Ex_Str = "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Case "Aug_Moble" '验证手机号码
Ex_Str = "^1[3|5][0-9]\d{4,8}"
Case "Aug_Cell" '验证电话号码
Ex_Str = "(^[0-9]{3,4}\-[0-9]{3,8})|(^[0-9]{3,8})"
Case "Aug_Number" '验证是否为数字
Ex_Str = "^[0-9]+"
Case "Aug_China" '验证是否为中文
Ex_Str = "^[\u0391-\uFFE5]+"
Case "Aug_UserName" '验证用户名只能为5-20位
Ex_Str = "^[A-Za-z0-9_]{5,20}"
Case Else
Ex_Str = "错误"
End Select
Reg_Ex.Pattern = Ex_Str
Reg_Ex.IgnoreCase = True
Reg_Ex.Global = True
Set Match = Reg_Ex.Execute(s)
IF Match.Count Then g_ExStr = True
End Function
IF g_ExStr("Aug_Email",request.form("email")) = False Then
Response.Write("<script language=""JavaScript"">alert(""E-mail can not be empty!"");history.go(-1);</script>")
response.end
end if