首页前端开发其他前端知识asp email邮箱地址验证正则表达式

asp email邮箱地址验证正则表达式

时间2024-02-01 16:16:02发布访客分类其他前端知识浏览222
导读:收集整理的这篇文章主要介绍了asp email邮箱地址验证正则表达式,觉得挺不错的,现在分享给大家,也给大家做个参考。 上篇文章我们用字符串查找的方法实现了asp email邮箱地址的验...
收集整理的这篇文章主要介绍了asp email邮箱地址验证正则表达式,觉得挺不错的,现在分享给大家,也给大家做个参考。

上篇文章我们用字符串查找的方法实现了asp email邮箱地址的验证,有可能比较喜欢正则表达式的朋友,这里也给出相应的代码。
方法一
复制代码 代码如下:
Public Function ChkMail(ByVal Email)
Dim Rep,Pmail : ChkMail = True : Set Rep = New RegExp
Rep.Pattern = "([.a-zA-Z0-9_-]){ 2,10} @([a-zA-Z0-9_-]){ 2,10} (.([a-zA-Z0-9]){ 2,} ){ 1,4} $"
Pmail = Rep.test(Email) : Set Rep = Nothing
If Not Pmail Then ChkMail = False
End Function

邮箱地址验证二
复制代码 代码如下:
%
Function iSEMail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
regEx.Pattern = "^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"
regEx.IgnoreCase = True
Set Match = regEx.Execute(strng)
if match.count then isemail= true
End Function
%>

方法三
复制代码 代码如下:
Public Function IsEmail(ByVal PString)
Dim Plt,Pgt : Plt = False : Pgt = False
For x = 2 To Len(PString) - 1
If Mid(PString,x,1) = "@" Then Plt = True
If Mid(PString,x,1) = "." And Plt = True Then Pgt = True
Next
If Plt = True And Pgt = True Then
IsEmail = True
Else
IsEmail = False
End if
End Function
%>

我们来看看验证一的实例使用方法
复制代码 代码如下:
If ChkMail(admin@jb51.net) = True Then
Response.WrITe "格式正确"
Else
Response.Write "格式有误"
End If

您可能感兴趣的文章:
  • JS 日期验证正则附asp日期格式化函数
  • asp 验证输入网址是否有效并可以访问 与正则验证输入网址
  • asp 图片正则 替换,替换前检查图片是不是本地地址的方法
  • 在ASP中用正则表达式对象来校验数据的合法性

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!

aspemail

若转载请注明出处: asp email邮箱地址验证正则表达式
本文地址: https://pptw.com/jishu/595628.html
PHP html标签正则替换并可自定义正则规则 ExtJs 正则表达式小结

游客 回复需填写必要信息