Quoted email validation


I am writing an email validation code and I stack up with the qouted email validation.
Mainly I used Wikipedia to create conditions but I also used Regular Expressions Info too to create regEx and understand clearly the rules…

  • Wikipedia interpretation:

If quoted, it may contain Space, Horizontal Tab (HT), any ASCII graphic except Backslash and Quote…

  • Regular Expressions Info interpretation:

allowing any string of ASCII characters between the quotes. Whitespace characters, double quotes and backslashes must be escaped with backslashes.

The space is a whitespace character

My question is:
" "@example.org on the Wikipedia is a valid email address
But not escaped. Need to escape the space character or not?
And anyway: how can be valid the above email if not include any local part?
I don’t understand. :frowning:

Email validation to that degree on the client is largely pointless, as it doesn’t verify if email exists, so for username just checking the range should be fine:

const quotedLocal = /"["(),:;<>@\[\\\]\t \w!#$%&'*+-/=?^`{|}~]{1,62}"/;
const unquotedLocal = /[\w!#$%&'*+-/=?^`{|}~]{1,64}/;
const localPart = new RegExp(`${quotedLocal.source}|${unquotedLocal.source}`);
/* ... and so on */

99.99% of email systems would not allow this kind of address to be registered and even if someone’s lucky to get it, it would be practically unusable as many websites will not validate that.

Yes, thank you for answer.
I just finished right now with the email validation code. It was really hard. But I learned a lot new thinks… so I don’t mind.
If anyone want to test, please visit to My recipe Box, click on login and go to the sign up page.
The email validation already works. My aim was to inform the user if anything wrong.
Code can be found here (email() method).
The error message can be visible at blur event.

Maybe later I will update more some functionality. Example forbidden the commented email, the quoted email or the ip address domain in email…
I splitted the validation the smallest possible parts and if anywhere fails the email the method return null and don’t check the rest of part. So if the email invalid more than one reason, then the user will get only the first found error… not all.
" "@example.org: this email I left invalid against the Wikipedia implementation. Any space character have to escaped until I not find the correct answer…
"\ "@example.org