473,770 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Email RegularExpressi on not working

The email reg exp that ships with the RegularExpressi onValidator 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 1283
try validationExpre ssion="\S+@\S+\ .\S{2,3}"

"Learning SQL Server" <no.mail.com> wrote in message
news:ue******** *****@TK2MSFTNG P10.phx.gbl...
The email reg exp that ships with the RegularExpressi onValidator 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******** *****@TK2MSFTNG P10.phx.gbl...
The email reg exp that ships with the RegularExpressi onValidator 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******** *****@TK2MSFTNG P10.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******** *****@TK2MSFTNG P10.phx.gbl...
The email reg exp that ships with the RegularExpressi onValidator 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******** *****@TK2MSFTNG P10.phx.gbl:
The email reg exp that ships with the RegularExpressi onValidator
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|i nfo|gov|int|mil |net|org|biz|na me|museum|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
2798
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
1055
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 like to permit the sign ? in my string, but only one or two
1
1927
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 validator pointing this textbox and with the following expression: \w{6,8}
2
1235
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
2221
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 the Validation Expression property . It restrict every character execpt 0 to 9. How to fixed this? I used + in validation Expression property of Regular Expression Validator Control. All are working except when entering the character \, which...
3
1753
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 ControlToValidate="txt1" ValidationExpression="{5}-{4}|{5}" ErrorMessage ="Invalid Input" Display="Dynamic" runat="server"/> <asp:Button id="btn" Text="SUBMIT" runat="server"/> </form>
1
1530
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 TextBox so that it accepts 8-digit number or more than 8-digit numbers using RegularExpressions? Also how do I validate the TextBox so that it accepts 8 or more than
1
2041
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 correct the entry and press the signup button . At that time i want setfocus on that zip textbox. all such things happen in asp.net and i want javascript for the setfocus.
0
762
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 1(or)12(or)123(or)123,1(or)123,12(or)123,123(or)123,123,1(or)123,123,12(or)123,123,123 same format for the rest. It is Working fine when u put a RegularExpressionValidator Control in the Form.But ,our requirement is to get the Expression from the...
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.