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.
appview/email/email.go
appview/email/email.go
This file has not been changed.
appview/email/email_test.go
appview/email/email_test.go
This file has not been changed.
History
2 rounds
2 comments
evan.jarrett.net
submitted
#1
1 commit
expand
collapse
appview/email: replace regex check with mail.ParseAddress
Signed-off-by: Evan Jarrett <evan@evanjarrett.com>
expand 1 comment
pull request successfully merged
evan.jarrett.net
submitted
#0
1 commit
expand
collapse
appview/email: Replace regex check with mail.ParseAddress. Add unit tests.
Signed-off-by: Evan Jarrett <evan@evanjarrett.com>
expand 1 comment
Good one! Can you re-author to fit the guidelines? Can just be "appview/email: replace regex check with mail.ParseAddress".
lgtm thanks!