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

Noticing some odd matches #9

Open
jdalrymple opened this issue Feb 21, 2020 · 5 comments
Open

Noticing some odd matches #9

jdalrymple opened this issue Feb 21, 2020 · 5 comments

Comments

@jdalrymple
Copy link

I was testing a few blobs of text with this regex rule but found some odd matches such as:

f="nr@context",c=e("gos")

This should return zero results, but, it returns : f="nr@context",c=e("go as a match.

Have you seen some of the regex suggestions here?

@jdalrymple
Copy link
Author

I've been using:

/(?!\S*\.(?:jpg|png|gif|bmp|jpeg|css|js)(?:[\s\n\r]|$))[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]{3,65}\.[A-Za-z_-]{2,4}/gi

personally and its been pretty solid

@sindresorhus
Copy link
Owner

This regex started out for use with email validation. That's why it's so loose. For the use it's better to have false-positives, than false-negatives. I think we could make the regex stricter when the exact: true option is not passed.

@jdalrymple
Copy link
Author

Fair enough

@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

4 participants