From 8b3aad940e915b9db11deb0f06d9e5338cfe3fdd Mon Sep 17 00:00:00 2001 From: mrsdizzie Date: Fri, 26 Apr 2019 11:40:22 -0400 Subject: [PATCH] Stricter domain name pattern in email regex (#6768) Backport of #6739 --- modules/markup/html.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/markup/html.go b/modules/markup/html.go index 4a2f36046a..0c3efd8b78 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -63,7 +63,7 @@ var ( // well as the HTML5 spec: // http://spec.commonmark.org/0.28/#email-address // https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type%3Demail) - emailRegex = regexp.MustCompile("[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*") + emailRegex = regexp.MustCompile("[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9]{2,}(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+") linkRegex, _ = xurls.StrictMatchingScheme("https?://") )