Skip to content

Commit 8b3aad9

Browse files
mrsdizzielafriks
authored andcommitted
Stricter domain name pattern in email regex (#6768)
Backport of #6739
1 parent 81adf6a commit 8b3aad9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/markup/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var (
6363
// well as the HTML5 spec:
6464
// http://spec.commonmark.org/0.28/#email-address
6565
// https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type%3Demail)
66-
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])?)*")
66+
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])?)+")
6767

6868
linkRegex, _ = xurls.StrictMatchingScheme("https?://")
6969
)

0 commit comments

Comments
 (0)