Email Regular Expression Regulator

Possible duplicate:
Does Regexp recognize email address hard?

Hello,

I would like to implement a validator only for the local part of the email address.

Any suggestions are welcome.

+4
source share
2 answers

From the email address in wikipedia (Syntax section) :

The local part of the email address can use any of these ASCII characters:

  • Uppercase and lowercase English letters (az, AZ)
  • Numbers 0 to 9
  • Characters! # $% and '* + - / =? ^ _ `{| } ~
  • Character. (period, period, complete stop), provided that it is not the first or last character and also provides that it does not appear two or more times in a row (for example, John..Doe @ example.com).

The syntax is formally defined in RFC 5322 section 3.4.1 and RFC 5321. It is defined by the grammar in which the local part begins, for example:

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] ... 
+1
source

Take a look at the following link. This is the best link I've found:

http://www.regular-expressions.info/email.html

+1
source

Source: https://habr.com/ru/post/1339159/


All Articles