On 08/19/2009 11:41 PM, Randal L. Schwartz wrote:
>>>>>> "Clemens" == Clemens Schwaighofer <clemens_schwaigho...@e-gra.co.jp> 
>>>>>> writes:
> 
> Clemens> Just in my opinion, this regex is completely too large. For basic
> Clemens> validating something like:
> Clemens> 
> ^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%&'*+-\/=?^_`{|}~\.]{0,6...@[a-za-z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,4}){1}$
> Clemens> works very well
> 
> Fails on ".mobile" TLD.  Has a pointless {1} in it, which does
> absolutely nothing, providing that the creator of the regex was already
> missing a few clues.
> 
> That's the problem with these kinds of regex... you test it on what
> you know, but you're not consulting the *actual* *internet* specifications
> (which have been readily available since the dawn of Internet time).
> 
> Either use the regex I pointed to already, or stay with the simpler:
> 
>   /\...@.*\s/
> 
> which will at least not deny anyone with a *perfectly legitimate* email
> address from making it into your system.
> 
> Or, use your regex *only* in an *advice* category, with the ability
> for the user to say "yes, I'm really sure this is my address".
> 
> Please, for the sake of the net, do the Right Thing here.  This is
> what I'm arguing for.  Anything less than that, and your code deserves
> to end up in thedailywtf.com as an example of what *not* to do.

I am not going to defend any regex here, but in my opinion it helps on
what I want to see in email addresses.
Yes it fails on mobile, but I have not yet seen one. Probably the best
thing is to test nothing at all. Just accept it ...


-- 
[ Clemens Schwaighofer                      -----=====:::::~ ]
[ IT Engineer/Web Producer/Planning                          ]
[ E-Graphics Communications SP Digital                       ]
[                6-17-2 Ginza Chuo-ku, Tokyo 104-8167, JAPAN ]
[ Tel: +81-(0)3-3545-7706            Fax: +81-(0)3-3545-7343 ]
[ http://www.e-gra.co.jp                                     ]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to