Verify Email Address is Valid with

Good morning. As of this writing, the stock market appears to be on the verge of a complete collapse today. They have already halted selling and the market has not even opened due to the fall the futures market has already taken. Watching my retirement fly out the window as my broker is telling me to sit tight is not an easy thing for me to do. I am a person that has trouble sitting idly by and doing nothing. But that is my own character defect.

Anyway, the task before me is simple yet needed. I want to verify that the user has actually entered a valid email address. We are checking to make sure it is in a format that is an email address, not whether or not it is a legitimate email address. we accomplish by using regular expressions. To be honest, the regular expressions subject torments me. I don’t care for it but it works here nicely.

Make it a great day!

Imports System.Text.RegularExpressions

Function EmailAddressCheck(ByVal emailAddress As String) As Boolean
              Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
              Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
              If emailAddressMatch.Success Then
                  EmailAddressCheck = True
                  EmailAddressCheck = False
              End If
          End Function


Technorati Tags: ,,,,,,,,,,,,,

Windows Live Tags: address,,.NET Framework,csharp,Verify,Email,Valid,user,subject,System,Text,RegularExpressions,Match,Regex


  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: