From 7be0e703aed65b0b37e79a55c179d0181e93527a Mon Sep 17 00:00:00 2001 From: HazemSayad <94578938+HazemSayad@users.noreply.github.com> Date: Thu, 9 Jun 2022 00:15:54 +0300 Subject: [PATCH] Fixed email address validation regex The original 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 is already a good fit and works flawlessly so far so it is added into the commit --- regexsnippets.code-snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regexsnippets.code-snippets b/regexsnippets.code-snippets index e882d76..2a2239f 100644 --- a/regexsnippets.code-snippets +++ b/regexsnippets.code-snippets @@ -1,7 +1,7 @@ { "Validate E-Mail Address": { "prefix": "!valemail", - "body": "/^[A-Z0-9!#$%&'*+/=?^_`{|}~-][A-Z0-9!#$%&'*+/=?^_`{|}~.-]*[A-Z0-9!#$%&'*+/=?^_`{|}~-]@[A-Z0-9][A-Z0-9-]*\\.[A-Z0-9-]*[A-Z0-9]$/igm", + "body": "/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/igm", "description": "Validates the given email address" }, "Validate Hexadecimal Color Value": { @@ -320,4 +320,4 @@ "body": "<(FONT|font)([ ]([a-zA-Z]+)=(\"|\\')[^\"\\\\']+(\"|\\'))*[^>]+>([^<]+)(<\/FONT>|<\/font>", "description": "Replaces all the font tags in the given string with a single space" } -} \ No newline at end of file +}