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

Issue with Email Addresses Getting pulled In #13

Closed
JimmyGalar opened this issue Aug 19, 2021 · 4 comments
Closed

Issue with Email Addresses Getting pulled In #13

JimmyGalar opened this issue Aug 19, 2021 · 4 comments

Comments

@JimmyGalar
Copy link

So we allow our end users to send test strings out and those strings can contain a mix of urls and email addresses. We are using a email regex function to pull out all email addresses and validate those emails against a white list that we have. We also do the same for urls using url-regex-safe to pull out URLs from the string and validate against a different white list.

The issue I am encountering is that url-regex-safe is pulling in portions of the email or the email domain.

For example: This is a test of our notification system, for any questions please go to www.test.com/info for further details. To get further information on the process please email test@test.com, or Bob.Smith@test.com.

What url-regex-safe will do is get www.test.com/info, test.com, and Bob.Sm to be evaluated.

Can anything be done to exclude email addresses from the urlRegexSafe function?

@niftylettuce
Copy link
Collaborator

niftylettuce commented Aug 19, 2021 via email

@JimmyGalar
Copy link
Author

Am doing that to get around what I found above, just was hoping there was a way to tweak url-regex-safe to just exclude the emails versus the parsing am doing.

@pjotrsavitski
Copy link
Contributor

I just had a few cases that has both emails and URLs in them. Everything worked fine and email addresses were left alone. I did use it like urlRegexSafe({ strict: true }). This should disregard emails.

@niftylettuce
Copy link
Collaborator

If you had tests to add that fail please add!

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

3 participants