Wednesday 4 January 2012

Validate Email using RegEx

Dim regex As New
System.Text.RegularExpressions.Regex("^[\w-\.]+@([\w-]+\.)+[\w-]{2,3}$")
Dim match As System.Text.RegularExpressions.Match
match = regex.Match(myEmail)

If Not match.Success Then
ErrorMsg = ErrorMsg & "Email Not Valid"
End If

No comments:

Post a Comment