|
-
Mar 13th, 2008, 03:12 AM
#1
Thread Starter
Lively Member
Email Validation
Hi, I need to be able to check if a email address is a valid email so people can't just type in stuff like "jfsajfsajk_jsdljdal".
My code:
If System.Text.RegularExpressions.Regex.IsMatch(Trim(txtEmail.Text), "^[a-zA-Z0-9]@{a-zA-Z0-9][\w\.-]*[a-zA-Z][a-zA-Z]*[a-zA-Z]$") = False Then
lblFeedback.Text = "Please enter a valid Email Address before submitting"
lblFeedback.ForeColor = Drawing.Color.Red
End If
But this isn't working for me, can you see where I went wrong.
Thanks.
-
Mar 13th, 2008, 04:27 AM
#2
Hyperactive Member
Re: Email Validation
try out this
"^[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]$"
OR
".+@.+\\.[a-z]+"
Thankx
Koolprasad2003
MCP, MCTS, Microsoft MVP [Asp.Net/IIS]
For more .NET development tips visit .NET Tips
If the post is useful then please  Rate it
-
Mar 13th, 2008, 05:19 AM
#3
Thread Starter
Lively Member
Re: Email Validation
that worked great, thanks mate.
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
|