validator.js
validator.js copied to clipboard
Email validation bug.
Validation is wrong.
var validator = require('validator');
console.log(validator.isEmail("[email protected]")); // true
Issue #948 had raised some concern on a similar note on email validation. The PR's #967, #1058 and #1063 are trying to solve this issue. I will take some time to check this issue and the above-mentioned issue and PR's, and try to find out a solution for the same. Thanks for sharing @AudriusBuika.
also
console.log(validator.isEmail("david^[email protected]"));
Thanks, @XDavidT for that feedback.
We are currently working on a better way of making isEmail
validator better or more accurate.
Any feedback, assistance will highly be appreciated.
Also, if you have some links to articles of possible invalid or valid emails, or rules for email validator, you can send them here.
Thanks, @XDavidT for that feedback. We are currently working on a better way of making
isEmail
validator better or more accurate. Any feedback, assistance will highly be appreciated. Also, if you have some links to articles of possible invalid or valid emails, or rules for email validator, you can send them here.
Email address is split to 3 section: (Username @ Domain . 'suffix domain list' )
-
User name: Must start&end with letter or number Inside, user can use dot (.) or hyphen (-) or underscore () for once between Number/Letter Between each number/letter, you can use only one time of '.' and '-' and ''. Check out examples username: "d.-_5vid","d-.avid","2g3e4t5y"
-
Domain: must start&end with letter/number Also allow to include hyphen '-' as you want, but not underscore '_' at all. Important to notice, domain section can include a lot of dot's '.' in case of sub-domains.
-
Suffix: must use list of all suffix that exists today.
For 2-3 there is npm that can check that for us: https://github.com/miguelmota/is-valid-domain You can read more about right way to use: https://help.xmatters.com/ondemand/trial/valid_email_format.htm
@XDavidT, we do not need to an npm package to the package for that check. What we could do, is build a robust regex for validating it.
hi guys, I'm not sure if this is the right place but I have an existing email that is "[email protected]" but isEmail returns false even if the email address is valid and is existing. Also have "[email protected]" which also causes isEmail to return false. Any idea guys?
I'm not sure if it's an issue, but i can't use dot in display name, unless i put it into quote:
// some-service.com <[email protected]>
validator.isEmail('some-service.com <[email protected]>', {
allow_display_name: true,
require_display_name: true
}); // returns false
// "some-service.com" <[email protected]>
validator.isEmail('"some-service.com" <[email protected]>', {
allow_display_name: true,
require_display_name: true
}); // returns true
@jakub-gawryl -- can open this as a new bug?
@jakub-gawryl -- can open this as a new bug?
Sure - new issue is created here (#1649).
Also, not working for '+++''+++'[email protected]