View previous topic :: View next topic |
Author |
Message |
Don
Joined: 22 Oct 2004 Posts: 28
|
Posted: Fri Oct 22, 2004 8:47 am Post subject: ASP.NET regularexpression validator validating email |
|
|
Hi guys,
I'm trying to use regularexpression validator control in ASP.NET to validate an email address input field, but I can't get it right .
Do you know of a regular expression that will validate email address?
If you know one, please post it here.
Thanks in advance,
Don |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Fri Oct 22, 2004 10:28 am Post subject: |
|
|
Hi Don,
You can try the following regular expression for your email validation:
Code: | ^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Z
a-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-z
A-Z]{2,6}$
|
Cheers _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
swords
Joined: 11 May 2005 Posts: 1
|
Posted: Thu May 12, 2005 5:38 am Post subject: |
|
|
I have a simple code,just like this:
Code: | <asp:textbox id="tbemail" runat="server"/><br>
<asp:regularexpressionvalidator
runat="server"
controltovalidate="tbemail"
validationexpression="\w+\@\w+(\.com|\.net|\.org|\.cn|\.ca)"
errormessage="That is not a valid email"
display="dynamic"/><br>
|
_________________ http://wmjie.51.net/swords |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|