以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请教邮箱  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=86453)

--  作者:hbhb
--  发布时间:2016/6/17 15:46:00
--  请教邮箱
大师:请问如何用代码对输入的邮箱进行形式性合规判断?
--  作者:大红袍
--  发布时间:2016/6/17 16:23:00
--  
Dim str As String = "123@789.eee"
Dim reg As new System.Text.RegularExpressions.Regex("^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w{2,3}){1,3})$")
If reg.Ismatch(str) = True Then
    msgbox("匹配")
End If

--  作者:hbhb
--  发布时间:2016/6/17 17:30:00
--  
谢谢!服务器地址pop.mail.yahoo.com.cn的判断又怎么写?
--  作者:大红袍
--  发布时间:2016/6/17 18:47:00
--  

3楼什么意思?

 

Dim str As String = "popmail@yahoo.com.cn"
Dim reg As new System.Text.RegularExpressions.Regex("^[a-z0-9]+([._\\\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$")
If reg.Ismatch(str) = True Then
    msgbox("匹配")
Else
    msgbox("不匹配")
End If