Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Golang

`
^(?P<name>[a-zA-Z0-9.!#$%&'*+/=?^_ \x60{|}~-]+)@(?P<domain>[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])?)*)$
`
gm

Description

A regexp to validate an email address according to https://html.spec.whatwg.org/#valid-e-mail-address . Note that the backslash in the name part of the regexp on that site is there to escape the forward slash, which is not needed in Go.

Submitted by markus@maragu.dk - 3 years ago