Function to validate Email address

Posted by Virendradugar under VB.NET category on | Views : 2939
This function will validate the email address.

Public Shared Function ValidateEmailAddress(ByVal strString As String) As Boolean
Dim strRegx As String = "([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})"
Dim strArr() As String
strArr = strString.Split(",")
For Each str As String In strArr
If str.Length > 0 Then
If System.Text.RegularExpressions.Regex.IsMatch(str, strRegx) Then
ValidateEmailAddress = True
ValidateEmailAddress = False
Exit For
End If
End If
End Function

Comments or Responses

Posted by: Vinay13mar on: 11/25/2012 Level:Starter | Status: [Member] | Points: 10

Login to post response