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

This string passes as an exact match: '<[email protected]>' #2

Open
smvilar opened this issue Mar 3, 2016 · 10 comments
Open

This string passes as an exact match: '<[email protected]>' #2

smvilar opened this issue Mar 3, 2016 · 10 comments

Comments

@smvilar
Copy link

smvilar commented Mar 3, 2016

emailRegex({exact:true}).test('<[email protected]>') // true :(

@SamVerschueren
Copy link
Contributor

This library seems quite loose in terms of matching email patterns, is that correct? As I can see in the tests that !#$%&amp;*+/=?^{|}[email protected] for example is an exact match. So if special characters like that are allowed but <[email protected]> isn't, what about the following situations

Just so I can expand the test cases and make sure the correct situations are covered.

@gabooh
Copy link

gabooh commented Apr 13, 2016

I have the same issue, many false positive are found.

@vaticancameo
Copy link

matching against '[email protected], some text' will return '[email protected],' with the comma

@gtwilliams03
Copy link

gtwilliams03 commented Jul 12, 2018

I would like to use this module in my app - but I am finding that it returns some inconsistent results. Assuming this gist is a proper list of valid and invalid emails for testing: https://gist.github.com/cjaoude/fd9910626629b53c4d25

It does not seem to match correctly. The link above has 37 email addresses to test with - 17 are valid, 20 are invalid. Testing with this package results in 35 valid email addresses when I think it should only return 20.

It matches the following emails correctly:

It properly ignored these emails:

It errored on the following ones:

@lxsmnsyc
Copy link

lxsmnsyc commented Mar 15, 2019

I know that this is issue may be old but according to the RFC-822 on the Address Specification, the regex behaves correctly with the given test, that is because email addresses are not only limited to the format [email protected], but also someName<[email protected]>, so this issue is not really an issue.

@wmik
Copy link

wmik commented Jun 22, 2019

This is definitely an issue/bug.

emailRegex().test('f@il') // => true

Version 3.0.0

@sindresorhus
Copy link
Owner

@wmik Emails are not required to have a domain. You can find domain-less email on company intranets. We could add an option to require this however, as I agree it's not useful to allow domain-less emails for public services.

@hmelenok
Copy link

Please check, my regExp(https://regex101.com/r/YrpDBq/7) maybe it will help, only thing is left company emails

@niftylettuce
Copy link

I have published https://github.com/niftylettuce/email-regex-safe as an alternative to this package, with a lot of configurable options. PR's welcome.

@babaralishah
Copy link

Hi
I am on Angular

And using the below regex:

'^[a-z0-9]+([._-]?[a-z0-9]+)+@[a-z0-9]+([._-]?[a-z0-9]+)+\\.[a-z]{2,3}$'

But its not fulfilling my requirement, my requirement is below:

saa5@me-d_d_u.co

please anyone tell me, why this regex is not working for my above mentioned case.

Regards
Babar Ali Shah

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

No branches or pull requests