Click to See Complete Forum and Search --> : VB.NET - Email Validation Function
scuzymoto
May 25th, 2006, 07:39 PM
Simple regular expression I found and have used succesfully to validate emails submitted to my website.
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
Else
EmailAddressCheck = False
End If
End Function
kaydash
May 10th, 2007, 03:42 AM
Simple regular expression I found and have used succesfully to validate emails submitted to my website.
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
Else
EmailAddressCheck = False
End If
End Function
Sorry Scuzymoto,
I am still an amatuer at regular expression.
Can you explain the use of ""^[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]$" ?
BlackCat
biggreen96
Jun 22nd, 2007, 03:02 AM
bringing it back from the dead, my first post even too.
I am still an amatuer at regular expression.
Can you explain the use of ""^[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]$" ?
BlackCat and biggreen96
scuzymoto
Jun 22nd, 2007, 10:19 AM
An excellent website to describe all you could ever want to know...
http://www.regular-expressions.info/tutorialcnt.html
raaghav
Apr 6th, 2010, 05:20 AM
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
synersoft
Feb 12th, 2011, 06:44 PM
This seems to reject underscores _ in the email address, as in:
Test_Email@test.com
-Jay:confused:
robertsams23
Mar 22nd, 2011, 03:08 AM
check this url
http://net-informations.com/vbprj/communications/email-validation.htm
robert
satheeshs
Dec 12th, 2011, 05:00 AM
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
Else
EmailAddressCheck = False
End If
End Function
i want this code invb6.0 help me
Nightwalker83
Dec 13th, 2011, 12:52 AM
i want this code invb6.0 help me
Check the VB6 code bank for the equalivant code.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.