Issue:
The dumb users copy email addresses with a space after and past to the email text box in a web form. They then found that they cannot submit the form. The email looks ok, but because there is a space behind the standard email validation regular expression declare it as wrong email.
Solution:
Standard Email validation regular expression is,
^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
Add an extra space behind the standard regular expression to support dumb users,
^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z\s]{2,9})$
Resources:
http://msdn.microsoft.com/en-us/library/ms998267.aspx
http://msdn.microsoft.com/en-us/library/hs600312.aspx
http://www.regular-expressions.info/tutorial.html
http://regexlib.com/CheatSheet.aspx
Leave a Reply