-
May 25th, 2006, 06:39 PM
#1
Thread Starter
Hyperactive Member
VB.NET - Email Validation Function
Simple regular expression I found and have used succesfully to validate emails submitted to my website.
VB Code:
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
-
May 10th, 2007, 02:42 AM
#2
New Member
Re: VB.NET - Email Validation Function
Originally Posted by scuzymoto
Simple regular expression I found and have used succesfully to validate emails submitted to my website.
VB Code:
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
-
Jun 22nd, 2007, 02:02 AM
#3
New Member
Re: VB.NET - Email Validation Function
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
-
Jun 22nd, 2007, 09:19 AM
#4
Thread Starter
Hyperactive Member
Re: VB.NET - Email Validation Function
An excellent website to describe all you could ever want to know...
http://www.regular-expressions.info/tutorialcnt.html
-
Apr 6th, 2010, 04:20 AM
#5
New Member
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
-
Feb 12th, 2011, 06:44 PM
#6
New Member
Re: VB.NET - Email Validation Function
This seems to reject underscores _ in the email address, as in:
Test_Email@test.com
-Jay
-
Mar 22nd, 2011, 02:08 AM
#7
New Member
Re: VB.NET - Email Validation Function
-
Dec 12th, 2011, 05:00 AM
#8
New Member
Re: VB.NET - Email Validation Function
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
-
Dec 13th, 2011, 12:52 AM
#9
Re: VB.NET - Email Validation Function
Originally Posted by satheeshs
i want this code invb6.0 help me
Check the VB6 code bank for the equalivant code.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|