Archive for December, 2009

Email Address Validation

Email addresses have a local-part and a domain separated by an (unquoted) “@” symbol. The local-part must be either a dot-atom or a quoted string, and the domain must be either a domain name or a domain literal.

A dot-atom can only contain letters, numbers, dots, and the following characters: ! # $ % & ‘ * + – / = ? ^ _ ` { | } ~. However, neither the first nor the last character can be a dot, and two or more consecutive dots are not allowed. The maximum length of a dot-atom is 64 characters. A regular expression to match for a dot-atom local-part would be as follows:

// Dot-atom

"/^(?!.{65,})([!#-'*+\/-9=?^-~-]+)(?>\.(?1))*$/iD"

Read More

Tags: ,

Sunday, December 20th, 2009 PHP 18 Comments