View Single Post
Old 02-21-2008, 01:32 AM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,267
Thanks: 90
Wildhoney is on a distinguished road
Default

I think we had a discussion similar to this before, and the conclusion was that we as programmers should not be using any advanced regex to check the syntax of an email address. After all, email validation would weed out any invalid emails, and then a crontab would come along and clear out any inactive accounts.

However, we should definitely by using a simple regex for checking the very simple structure of any given email address. Such as like:

Code:
^.+?@.+?\..+$
This will prevent people from clearly not entering a valid email address - often by mistake.

Furthermore, being as sure as possible that an email address is valid would be somewhat slow, and that is surely not a favourable sacrifice. After all, email address structures can be very complicated.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
Gareth (02-21-2008)