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

isEmail() doesnt work with XXX.YYY@ZZZ.com #6

Open
ianeinser opened this issue Aug 14, 2019 · 4 comments
Open

isEmail() doesnt work with XXX.YYY@ZZZ.com #6

ianeinser opened this issue Aug 14, 2019 · 4 comments
Labels

Comments

@ianeinser
Copy link

Hi,

the isEmail() function doesn't work with XXX.YYY@ZZZ.com but XXXYYY@ZZZ.com even though XXX.YYY is acceptable by most top email providers like outlook.com and gmail.com

@nisrulz nisrulz added the bug label Aug 15, 2019
@nisrulz
Copy link
Owner

nisrulz commented Aug 15, 2019

I will take a look at it. Possibly need to update the regex for it.

@xcesaralejandro
Copy link

Same problem ¿Any solution?

@bipinvaylu
Copy link

Hey @nisrulz I am also passing this issue. It doesn't accept . [DOT] in email id before @ sign. Let me know if you are going to fix it or guide me to do so.

@nisrulz
Copy link
Owner

nisrulz commented Dec 3, 2020

This is a tricky problem. I actually tried to fix this, but I didn't want to push a fix that was not complete.

Here is more to read about the regex approach in detecting emails: https://emailregex.com/

The relevant regex from the above website:

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

I could just go ahead and use this, but I also get performance penalty. So I haven't yet found a valid solution for it.

My suggestion is to use the custom regex functionality of this lib and provide it the regex from the linked website above. The reason is simple that putting it as part of the library would affect everyone, while using the custom regex version is only limited to people who actually want it and agree to the performance penalty.

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

No branches or pull requests

4 participants