Eric Wise

Sponsors

The Lounge

Wicked Cool Jobs

Blogs I Read

Fun & Games

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
IsEmailAddress

Short, sweet, and to the point.

    Protected Function IsEmailAddress(ByVal Address As String) As Boolean
        Return System.Text.RegularExpressions.Regex.IsMatch(Address, "^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$")
    End Function

Posted Wed, Mar 30 2005 11:42 AM by Eric Wise

[Advertisement]

Comments

Eric Wise wrote re: IsEmailAddress
on Fri, Apr 1 2005 3:26 PM
Like most snippets there's a story behind this one.

The system I was working on had a SQL server based messaging system that emulates email, except the user requirement is that it is a closed system.

Now, in the effort to support an Outlook style feel I set it up so users could create contacts, and put those contacts into groups. The IsEmailAddress function you see here was a check when parsing the To: CC: or BCC: fields using a split(";") command. Since they could type in a group name or an "email" address I used this function to check to see whether it was an "email" address or a group.
mohsin wrote re: IsEmailAddress
on Tue, Jul 22 2008 9:08 AM

google

Devlicio.us