You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The email validator has a character length restriction between 2 and 7 characters.
However, there are valid TLDs that are longer than that, e.g. .technology, .international, .photography, .university, .solutions, .foundation, etc. In this list of all currently valid TLDs, there are many that are longer than 7 characters; it seems that the maximum length currently in use is 24. In fact, TLDs per the ICANN spec can be up to 63 characters, according to MDN.
To Reproduce
Steps to reproduce the behavior:
Enter an email with a TLD longer than 7 characters, such as .foundation, into an input using the email validator
Try to submit your form
Email validation error is triggered
Expected behavior
No error should be triggered by valid TLDs (i.e. those with lengths up to 63 characters).
Additional context
export function email(): Validator {
return (value: any) => {
// The `{2,7}` here is what should be updated to `{2,63}`
const regex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
return { valid: Boolean(value) && regex.test(value), name: 'not_an_email' };
};
}
The text was updated successfully, but these errors were encountered:
Describe the bug
The
email
validator has a character length restriction between 2 and 7 characters.However, there are valid TLDs that are longer than that, e.g.
.technology
,.international
,.photography
,.university
,.solutions
,.foundation
, etc. In this list of all currently valid TLDs, there are many that are longer than 7 characters; it seems that the maximum length currently in use is 24. In fact, TLDs per the ICANN spec can be up to 63 characters, according to MDN.To Reproduce
Steps to reproduce the behavior:
.foundation
, into an input using theemail
validatorExpected behavior
No error should be triggered by valid TLDs (i.e. those with lengths up to 63 characters).
Additional context
The text was updated successfully, but these errors were encountered: