// Email checks if the given string is a valid email address and returns an error if not.
Email checks if the given string is a valid email address and returns an error if not.
// Email checks if the given string is a valid email address and returns an error if not .
func Email(v string) error {
	if err := nonEmpty(v); err != nil {
		return err
	}
	invalidError := errors.New("invalid email address")
	split := strings.Split(v, "@")
	if len(split) != 2 {
		return invalidError
	}
	localPart := split[0]
	domain := split[1]
	if nonEmpty(localPart) != nil {
		return invalidError
	}
	if isMatch(`\s`, localPart) {
		return invalidError
	}
	return DomainName(domain)
}
func Email ( v string ) error { if err := nonEmpty ( v ) ; err != nil { return err } invalidError := errors . New ( " " ) split := strings . Split ( v , " " ) if len ( split ) != 2 { return invalidError } localPart := split [ 0 ] domain := split [ 1 ] if nonEmpty ( localPart ) != nil { return invalidError } if isMatch ( `\s` , localPart ) { return invalidError } return DomainName ( domain ) }
Email checks if the given string is a valid email address and returns an error if not.
Email checks if the given string is a valid email address and returns an error if not .
// No whitespace allowed in local-part