473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Email RegularExpression not working

The email reg exp that ships with the RegularExpressionValidator doesnt like
this email address:

us**@blah.ru

Or any other email domain that contains only 2 letters after the dot.

It *looks* like it should (I notice the qualifier at the end of the
statement for 2 or more letters), but the validator always fires anyway.
Anyone else notice similar behavior or do I just need some sleep?


Nov 17 '05 #1
4 1262
try validationExpression="\S+@\S+\.\S{2,3}"

"Learning SQL Server" <no.mail.com> wrote in message
news:ue*************@TK2MSFTNGP10.phx.gbl...
The email reg exp that ships with the RegularExpressionValidator doesnt like this email address:

us**@blah.ru

Or any other email domain that contains only 2 letters after the dot.

It *looks* like it should (I notice the qualifier at the end of the
statement for 2 or more letters), but the validator always fires anyway.
Anyone else notice similar behavior or do I just need some sleep?

Nov 17 '05 #2
This is the one I use:

[\w-.]+?@([\w-]+?\.)+[\w]{2,}

I've tested it fairly extensively, including a couple of embarassing
incidents where potential customers trying to register emailed me to tell me
that my form wouldn't accept their email address, resulting in the included
regular expression.

I haven't had any emails for a while now to tell me I'm rejecting valid
addresses.

Colin

"Learning SQL Server" <no.mail.com> wrote in message
news:ue*************@TK2MSFTNGP10.phx.gbl...
The email reg exp that ships with the RegularExpressionValidator doesnt like this email address:

us**@blah.ru

Or any other email domain that contains only 2 letters after the dot.

It *looks* like it should (I notice the qualifier at the end of the
statement for 2 or more letters), but the validator always fires anyway.
Anyone else notice similar behavior or do I just need some sleep?

Nov 17 '05 #3
Colin:
I was looking at another expression *sheepish grin*
"Colin Young" <x@nospam.com> wrote in message
news:Oq*************@TK2MSFTNGP10.phx.gbl...
This is the one I use:

[\w-.]+?@([\w-]+?\.)+[\w]{2,}

I've tested it fairly extensively, including a couple of embarassing
incidents where potential customers trying to register emailed me to tell me that my form wouldn't accept their email address, resulting in the included regular expression.

I haven't had any emails for a while now to tell me I'm rejecting valid
addresses.

Colin

"Learning SQL Server" <no.mail.com> wrote in message
news:ue*************@TK2MSFTNGP10.phx.gbl...
The email reg exp that ships with the RegularExpressionValidator doesnt

like
this email address:

us**@blah.ru

Or any other email domain that contains only 2 letters after the dot.

It *looks* like it should (I notice the qualifier at the end of the
statement for 2 or more letters), but the validator always fires anyway.
Anyone else notice similar behavior or do I just need some sleep?


Nov 17 '05 #4
"Learning SQL Server" <no.mail.com> wrote in
news:ue*************@TK2MSFTNGP10.phx.gbl:
The email reg exp that ships with the RegularExpressionValidator
doesnt like this email address:

us**@blah.ru

Or any other email domain that contains only 2 letters after the
dot.

It *looks* like it should (I notice the qualifier at the end of
the statement for 2 or more letters), but the validator always
fires anyway. Anyone else notice similar behavior or do I just
need some sleep?


Here's a regex I use to validate e-mail addresses:

^[-a-zA-Z0-9][-.a-zA-Z0-9]*@[-.a-zA-Z0-9]+(\.[-.a-zA-Z0-
9]+)*\.(com|edu|info|gov|int|mil|net|org|biz|name|mu seum|coop|aero|pr
o|[a-zA-Z]{2})$
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mg | last post by:
Does someone have RegularExpression code (C# WebForm) for server-side validation of Date (mm/dd/yyyy) ... including leap year?
1
by: fabrice | last post by:
Hello, In a search form, i want to permit few characters (see below) and some signs as - _ / , . So thios my RegularExpression and it works. ValidationExpression="{4,20}" But i'd would...
1
by: Nicola Farina | last post by:
Hi all, i've a form with a textbox that user "must" fill with a password. I want to check if there's a password inside, and if it's between 6 an 8 chars. I've placed a regularexpression...
2
by: Fabio | last post by:
Hi all, I have this simple string for example: anything<font>catch this</font> and I need a regularexpression to Catch "catch this" so, I can use this pattern: ">+"
2
by: den 2005 | last post by:
Hi everybody, How do restrict entering these characters <>\"%';()& and telling user these caharcters are not allowed to be enter in the textbox field using RegularExpression Validator? I put in...
3
by: Arpan | last post by:
Consider the following code which validates a TextBox using RegularExpression: <form id="form1" runat="server"> <asp:TextBox id="txt1" runat="server"/> <asp:RegularExpressionValidator...
1
by: Arpan | last post by:
Using RegularExpression, I want to validate a TextBox so that the TextBox accepts only 8-digit numbers. This can be done with the following RegularExpression: {8} But how do I validate the...
1
by: prp | last post by:
hi all, I have a problem.Suppose I use a regularexpression validator for zip code. An User fill wrong entry in the relevant textbox then regularexpression validator fires.but user did not...
0
by: softimasrinivas | last post by:
Regular Expression: ((\d{1,2},)?(\d{3},)*(\d{1,3}))|(\d+) I have a textbox that should allow 123,123,123,123,123,1 format.TextBox MaxLength is 21.The Problem is it should accept when you give...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.