Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dot in user-part #2

Closed
k4zh opened this issue Feb 8, 2022 · 1 comment
Closed

Dot in user-part #2

k4zh opened this issue Feb 8, 2022 · 1 comment

Comments

@k4zh
Copy link

k4zh commented Feb 8, 2022

Hi,

Thank you for your lib.

const validator = require('validator');

console.log(validator.isEmail('bob.foo-bar@test.com'));  // true

But using emailRegexSafe({ gmail: false }).exec('bob.foo-bar@test.com'), only foo-bar@test.com matches.

Is that expected behavior?

@titanism
Copy link
Contributor

Looking at the source of validator.isEmail (see https://github.com/validatorjs/validator.js/blob/cfcf9113c69b97477c409909a8729fa8efa0d595/src/lib/isEmail.js#L162-L170), it looks like they split by period to check local parts, and with each split, they test the user pattern. If any parts are not valid, then it rejects it and returns false. We added \\. to our regular expressions and also added a test.

This has been fixed and released in v2.0.0.

https://github.com/spamscanner/email-regex-safe/releases/tag/v2.0.0

Thanks for filing this issue @k4zh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants