Monday, 7 January 2013

Validating an Email Address

In order to validate an email address, use the following function;

Public Function IsValidEmailAddress(ByVal EmailAddress As String) As Boolean
    Dim Expression As New System.Text.RegularExpressions.Regex("\S+@\S+\.\S+")
 
    If EmailAddress = "" Then
 
        Return True
 
    Else
 
        Return Expression.IsMatch(EmailAddress)
 
    End If
    
End Function

No comments:

Post a Comment