dockwa / simple-react-validator

A simple react form validator inspired by Laravel validation.
https://dockwa.github.io/simple-react-validator
MIT License
276 stars 77 forks source link

Incorrect email validation #284

Open rubanraj54 opened 3 years ago

rubanraj54 commented 3 years ago

simple-react-validatoraccepts this email id pattern abcd@-xyz.com as a valid one, but actually, it is wrong.

Could you please fix this?

joshuagoran commented 2 years ago

I realize this is an old issue.


This request could be done with additional regex in the email validator. The current regex validates that the domain contains only A-Z, 0-9, . and - characters, but doesn't check for hyphens as the first/last character or for consecutive hyphens, both of which would be invalid domains.

However, maybe this was a conscious decision, as validating emails can be a slippery slope.