spamscanner/url-regex-safe

Issue with Email Addresses Getting pulled In

JimmyGalar opened this issue · 4 comments

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?

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.

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.

If you had tests to add that fail please add!