Possible Duplicate:
Regexp recognition of email address hard?
Hi,
I would like to implement validator for only local part of the email address.
Any suggestions please welcome.
Possible Duplicate:
Regexp recognition of email address hard?
Hi,
I would like to implement validator for only local part of the email address.
Any suggestions please welcome.
From the Email address article at wikipedia (Syntax section):
The local-part of the email address may use any of these ASCII characters:
- Uppercase and lowercase English letters (a–z, A–Z)
- Digits 0 to 9
- Characters ! # $ % & ' * + - / = ? ^ _ ` { | } ~
- Character . (dot, period, full stop) provided that it is not the first or last character, and provided also that it does not appear two or more times consecutively (e.g. John..Doe@example.com).
The syntax is formally defined in RFC 5322 section 3.4.1 and RFC 5321. It is defined by a grammar in which the local part starts like this:
local-part = dot-atom / quoted-string / obs-local-part atext = ALPHA / DIGIT / ; Printable US-ASCII "!" / "#" / ; characters not including "$" / "%" / ; specials. Used for atoms. "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~" atom = [CFWS] 1*atext [CFWS] dot-atom-text = 1*atext *("." 1*atext) dot-atom = [CFWS] dot-atom-text [CFWS] ...