vscode-regex-snippets
vscode-regex-snippets copied to clipboard
Email validation snippit matches improper emails as well
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:
- use the
!valemail
snippet:regex = !valemail
-
"test@gmail:com".match(regex)
matches
Expected behavior It should not match unacceptable symbols as per email standards
Screenshots
above pic shows that the regex matches
:com
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