iNET Interactive - Online Advertising Agency
          
Code Library A repository of sample code

Go Back  Xtreme .NET Talk > Knowledge Base > Code Library > Validating EMail Address Using RegEx


Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2002, 09:24 AM
mpappert mpappert is offline
Regular
 
Join Date: Oct 2002
Location: Ottawa, ON, Canada
Posts: 58
mpappert is on a distinguished road
Default Validating EMail Address Using RegEx

Not really a question, just some code. A small thanks for all the help I've gotten here, I figured I would post this in case someone else finds themselves needing an email verification routine ..

M.

Code:
Option Explicit On

Imports System.Text.RegularExpressions

Public Class IsValid

    Public Function emailAddress(ByRef strEmailAddress As String) As Boolean

        '[MP]   Returns True if the E-Mail Address is Valid (Matches Pattern)
        strEmailAddress = Trim$(strEmailAddress)
        Return Regex.IsMatch(strEmailAddress, "^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$")

    End Function

End Class
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating email address phreaky Regular Expressions 3 05-08-2005 05:23 PM
email address quahog ASP.NET 9 01-08-2004 05:23 PM
Validating E-mail address via SMTP mcharaia ASP.NET 1 11-05-2003 02:37 PM
Retrieving email address nibsy Interoperation / Office Integration 5 08-14-2003 07:55 AM
Selecting all items in a list view and validating a email address Winston Windows Forms 7 04-27-2003 08:08 AM

Advertisement: