DEV Community

Discussion on: The beauty of VerbalExpressions

Collapse
 
superboum profile image
Quentin Dufour • Edited

Don't use the email regex given in example, this one is wrong.
Here are some valid email address according to RFC822 that will not match the regex :

  • me@example.museum (the tld contains 6 characters)
  • John Smith <john@smith.com> (Yes, you can put a name in front of an enclosed email address like that)

Some times, using RegEx (or VerbalExpression) is not appropriate. In this case, you should probably write a parser. Here is the implementation of this parser in go : golang.org/src/net/mail/message.go...