Possible Duplicate:
How to use a regular expression to validate an email addresses?
\A[\w.-]+\w@[a-z\d\-.]+\.[a-z]+\z
What do you think of the above expression for email validation. Any errors, any loopholes? Thank in advance for the support.
Possible Duplicate:
How to use a regular expression to validate an email addresses?
\A[\w.-]+\w@[a-z\d\-.]+\.[a-z]+\z
What do you think of the above expression for email validation. Any errors, any loopholes? Thank in advance for the support.
What do you think of the above expression for email validation.
For one, it doesn't accept my address. So, there's obviously a bug in there somewhere. I suggest you read RfC5322 carefully, it describes the valid syntax for addresses quite clearly, although unfortunately it hasn't yet been updated for IDN.
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b
Regex from regular expressions info. It should match RFC 2822 standard.