Re: Regex for email validation

From: Date: Wed, 27 Aug 2008 18:05:03 +0000
Subject: Re: Regex for email validation
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-278806@lists.php.net to get a copy of this message
At 6:30 PM +0200 8/27/08, Per Jessen wrote:
Well, I left that for the OP to figure out. Still, your regex is worse - a domain name cannot contain '%'. The only valid characters for a domain name are letters, numbers and a hyphen. Also, maximum length for a domain name is 64 characters, which could/should be checked too.
Well, I stole that regex anyway -- I agree that % should have not been there.
No, they can't. There are no 8-bit characters allowed in an email-address. Check out RFC2821.
You can throw all the facts and documentation you want at me, but the left side of the @ has always been open to anything you want. The right side of the @ has had to deal with 7-bit limitation (the DNS problem). But, considering the work that the IDNS has done, (circa 2000) we can use Unicode characters on both sides of the @. However, the software (browsers and email apps) may/may-not be able to deal with it, as shown by my recent example of:
tedd@à.com
is a legal and working email address.
If that reads "tedd(at)<space>.com", it might be valid on your system, but not in public.
The email address is perfectly valid, and works, but our definition of "public" is apparently different. I claim if it's valid on any system, then it's public. I don't hold to the notion that if M$ doesn't recognize it then it isn't public. M$ has always had it's collective head up it's vested interest butt anyway. For demonstration Safari has absolutely no problems dealing with IDNS, whereas all IE's do. To prove my point, if you have Safari, try entering option v into the browser URL box and hit return. You don't have to enter anything else (i.e., no http://, www, or dot com). What will happen is that you will be automagically transported to one of my sites where the url is square-root dot com. However if you're dealing with one of the leading "also-ran" IE browsers, then you'll see the PUNYCODE equivalent, which was never intended to be seen by end users anyway. Just another example of how M$ always has a better idea. So, regardless of the documentation, which may be outdated, I know that Unicode characters can be used in IDNS and thus on both sides of the @, but it's the software that needs to catch up to the technology. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#278806) next »