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

[BUG] Some fake emails fails email validation regex #83

Closed
jcobhams opened this issue Jan 27, 2022 · 3 comments
Closed

[BUG] Some fake emails fails email validation regex #83

jcobhams opened this issue Jan 27, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@jcobhams
Copy link

Describe the bug
When using faker.Internet().Email(), some generated fake emails fails email regex patterns.
Some names like "O\"Connell", "O\"Conner", "O\"Hara", "O\"Keefe", "O\"Kon" found in here trips up a regex pattern for validating email addresses.

Regex: /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g

To Reproduce

In the off chance that you can get the library to pick one of these names and generate a fake email, you can run it against this regex validator: https://regexr.com/3e48o

Expected behavior
That faker.Internet().Email() returns a semantically valid email address format.

Screenshots
Screen Shot 2022-01-26 at 7 58 19 PM

Desktop (please complete the following information):

  • OS: MacOS Monterey
  • go version output: go version go1.17.6 darwin/amd64
@jaswdr
Copy link
Owner

jaswdr commented Jan 27, 2022

@jcobhams thank you for reporting 👍 , I've merged the fix for this issue and released it in 1.10.1, the fix will only generate names with valid characters, replacing with "_" otherwise, and includes a validation in tests to check that the email is valid to improve detection of this in the future.

@jaswdr jaswdr closed this as completed Jan 27, 2022
@jcobhams
Copy link
Author

Thanks for the quick fix and prompt response @jaswdr
🙏

@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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants