电子邮件地址格式验证
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了电子邮件地址格式验证相关的知识,希望对你有一定的参考价值。
Uses a regular expression to validate a string as a validly formatted email address.
''' <summary> ''' Determines whether provided email address is properly formatted. ''' </summary> ''' <param name="s"></param> ''' <returns></returns> ''' <remarks></remarks> Private Function IsValidEmailFormat(ByVal s As String) As Boolean Dim result As Boolean = False If Not String.IsNullOrEmpty(s) Then '^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$ Dim pattern As String = My.Settings.Email_Validation_Pattern Dim match As RegularExpressions.Match = RegularExpressions.Regex.Match(s, pattern) result = match.Success End If Return result End Function
以上是关于电子邮件地址格式验证的主要内容,如果未能解决你的问题,请参考以下文章