- From: Thomas Broyer <t.broyer@gmail.com>
- Date: Mon, 31 Aug 2009 10:09:22 +0200
On Mon, Aug 31, 2009 at 7:53 AM, Ian Hickson<ian at hixie.ch> wrote: > If we let > > ? X = [-a-zA-Z0-9!#$%&\'*+/=?^_`{|}~]+ > > ...then the regexp is: > > ? ^X(\.X)*@X(\.X)*$ > > I believe this is correct, yes. I used to have a mail address whose local part had both a leading and a trailing dot: .tom. at wanadoo.fr I never had any issue with it (and I tried many mail UAs at that time, no one ever ruled me out), except some web forms absolutely wanted (I supposed) \w+(\.\w+)*@\w+(\.\w)*\.[a-zA-Z]{2,3} or something similar (this is a regex commonly found on the web to validate email addresses ?at least it was something like 10 years ago?) IIUC RFC 5322, it is explicitly allowed if written as ".tom."@wanadoo.fr (which I assume would only be true when used in e-mail header fields; I'd personally expect a web form to accept .tom. at wanadoo.fr, and use whatever syntax is needed ?i.e. using a quoted string for the local part in this case? when sending a mail; I'd actually even expect this transformation to be done by the library used to send the mail: libsmtp or whatever) For a "good" regex to validate email addresses without too many false negatives (false negatives are far worse than false positive re. user experience), see http://www.regular-expressions.info/email.html But the one that you've now put in the spec is fine by me. -- Thomas Broyer
Received on Monday, 31 August 2009 01:09:22 UTC