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
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