check verify email address and validation

While developing new site i had to add email verification function in vb.net, here is a handy function written in VB.NET to verify if email address is valid email address. This function does not verify if email address exists but simply checks if the string entered by end user is a valid email address.

It can check most common domain TLD's (com, net, org etc) you can also add your own if you like. It also allow hyphen ( - ), under score ( _ ) and a period ( . ) in the username part of the email address.

 

Public Shared Function Is_Valid_Email(ByVal Email_Address As String) As Boolean 

	Dim reg_pattern As String = "^[-a-zA-Z0-9][-_.a-zA-Z0-9]*@[-.a-zA-Z0-9]+(\.[-.a-zA-Z0-9]+)*\." & _ 
	"(com|net|org|biz|ru|jobs|edu|me|ws|info|gov|int|mil|us|co.uk|cn|.pk|.in|name|museum|coop|aero|pro|tv|[a-zA-Z]{2})$"
 	
	Dim reg As New Text.RegularExpressions.Regex(reg_pattern, RegexOptions.IgnorePatternWhitespace)

        	If String.IsNullOrEmpty(Email_Address) Then
         		Return False
        	Else
            	Return reg.IsMatch(Email_Address)
        End If
End Function
 

 

 

 




Add Comments

Name: *
Email: *
URL:
Comments: *
 


Advertisements

MySQL HOSTING
MySQL hosting provider, clustering and replication supported. DBA Services Included.

SQL SERVER HOSTING
Reliable, powerful SQL Server 2008 hosting with ASP.NET on Windows 2008 Servers.

SQL Server DBA

I am a SQL Server DBA with almost 9 years of experience in database technologies.

 I am again in process of redesigning this website using ASP.NET 2.0 and AJAX. The main purpose of new SQL DBA website is to offer more features and make it easy for me to update contents on regular basis.