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

Fixed email address validation regex

Open HazemSayad opened this issue 2 years ago • 2 comments

The original latest code is escaping a back slash instead of escaping the dot, but the expression fails subdomains check such as @gmail.com.edu so there is a community pattern that is already a good fit and works flawlessly so far so it is added into the commit

Please check if the PR fulfills these requirements:

  • [x] The PR title and message describe the solution briefly.
  • [x] Documentation has been updated/added if relevant

What is the current behavior?

fixes #21 Also fixes email validation regex snippet where there was a typo maybe and instead of escaping the dot . the character being escaped was a backslash \.

What is the new behavior?

Matches emails correctly and works with subdomains as well such as @gmail.com.edu

Other information?

This is a significant change and improves on the email validation regex snippet

Tested manually on https://regexr.com/ Credits to the expression goes to: https://regexr.com/2rhq7

HazemSayad avatar Jun 08 '22 21:06 HazemSayad

Hey @HazemSayad thank you once again for helping the repository out, I just had one question, it doesn't seem to match uppercase emails now, was that the case even with the initial regex?

monizb avatar Jun 09 '22 03:06 monizb

hello @monizb

it doesn't seem to match uppercase emails now

the expression should work on both uppercase and lowercase letters since i am ending the expression with the i flag for ignore case in /...$/igm. If you are using the link for credits, please enable the ignore case flag from the flags drop down menu.

thank you once again for helping the repository out

You are most welcome, i find it a very helpful extension and i found an opportunity to help so here i am.

HazemSayad avatar Jun 09 '22 12:06 HazemSayad