Was troubleshooting an issue in discord and wrote some tests to verify things were parsed correctly. The orignal regex was missing leading and trailing period detection. Go has a built in function for parsing/validating email addresses based on the RFC that doesn't use regex, and performs slightly faster in a benchmark.
+7
-12
appview/email/email.go
+7
-12
appview/email/email.go
······-pattern := `^[a-zA-Z0-9.!#$%&'*+/=?^_\x60{|}~-]+@[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])?)*$`
······
+53
appview/email/email_test.go
+53
appview/email/email_test.go
···
···