You are on page 1of 1

1.

Imports System.Text.RegularExpressions
2.
3.
Function EmailAddressCheck(ByVal emailAddress As String) As Boolean
4.
5.
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]$"
6.
Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern
)
7.
If emailAddressMatch.Success Then
8.
EmailAddressCheck = True
9.
Else
10.
EmailAddressCheck = False
11.
End If
12.
13.
End Function

raaghav is an unknown quantity at this point (<10)


Re: VB.NET - Email Validation Function
Checkout this....
Some Simple Mothod.......

Dim Expression As New System.Text.RegularExpressions.Regex("\S+@\S+\.\S+")


If Expression.IsMatch(txtEMail.Text) Then
MsgBox("The email address is valid.")
Else
MsgBox("The email address is NOT valid.", MsgBoxStyle.Critical, "Invalid Mail ID
")
Exit Sub
End If