vscode-regex-snippets icon indicating copy to clipboard operation
vscode-regex-snippets copied to clipboard

Email validation snippit matches improper emails as well

Open HazemSayad opened this issue 2 years ago • 0 comments

Describe the bug using the !valemail snippet: /[A-Z0-9._%+-]+@[A-Z0-9-]+.+.[A-Z]{2,4}/igm it matches normal emails fine, BUT it also matches commas and some other symbols. Examples: @gmail,com, @gmail?com, @gmail:com match

To Reproduce Steps to reproduce the behavior:

  1. use the !valemail snippet: regex = !valemail
  2. "test@gmail:com".match(regex) matches

Expected behavior It should not match unacceptable symbols as per email standards

Screenshots image above pic shows that the regex matches :com

image above pic shows that the regex matches ?com

Additional context during testing, i found that i was able to create weird emails, so i also checked with regexr.com to verify what's going on

HazemSayad avatar Jun 04 '22 22:06 HazemSayad