我想检查电子邮件地址是否有效. 如何使用正则表达式在VB中验证电子邮件地址? ([\w-+]+(?:\.[\w-+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}) MSDN文章: How to: Verify That Email are in Valid E-Mail Format 此示例方法调
如何使用正则表达式在VB中验证电子邮件地址?
([\w-+]+(?:\.[\w-+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7})MSDN文章: How to: Verify That Email are in Valid E-Mail Format
此示例方法调用Regex.IsMatch(String,String)方法以验证字符串是否符合正则表达式模式.
Function IsValidEmailFormat(ByVal s As String) As Boolean Return Regex.IsMatch(s, "^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$") End Function