Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test@test-.com is showing as valid #828

Closed
rameshb4u opened this issue Jul 26, 2013 · 7 comments
Closed

test@test-.com is showing as valid #828

rameshb4u opened this issue Jul 26, 2013 · 7 comments

Comments

@rameshb4u
Copy link

in emails2 validation domain is accepted ends with '-'. Please fix the issue.

@nschonni
Copy link
Collaborator

Trailing - doesn't appear to violate the spec http://www.w3.org/Protocols/rfc822/3_Lexical.html can you provide a link to something showing that a trailing hyphen is invalid?

@rameshb4u
Copy link
Author

Here is the link and comment for RFC 883:

The labels must follow the rules for ARPANET host names. They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen. There are also some
restrictions on the length. Labels must be 63 characters or less.

http://tools.ietf.org/html/rfc883#page-56

@nschonni
Copy link
Collaborator

Thanks (I updated your link with the page number).
Do you want to PR a fix for this?

@michaelbishop
Copy link

RFC 883 is Obsoleted by: 1034, 1035

RFC 883 is not an Internet Standard, it is obsolete and historic.

http://tools.ietf.org/html/rfc1796
"It is a regrettably well spread misconception that publication as an
RFC provides some level of recognition. It does not, or at least not
any more than the publication in a regular journal. In fact, each
RFC has a status, relative to its relation with the Internet
standardization process: Informational, Experimental, or Standards
Track (Proposed Standard, Draft Standard, Internet Standard), or
Historic. This status is reproduced on the first page of the RFC
itself, and is also documented in the periodic "Internet Official
Protocols Standards" RFC (STD 1). But this status is sometimes
omitted from quotes and references, which may feed the confusion."

For a better understanding of the Internet Standards process:
http://tools.ietf.org/html/rfc2026

The W3C's August 6, 2013 HTML5 specifications for email is:
http://www.w3.org/TR/html5/forms.html#valid-e-mail-address

A valid e-mail address is a string that matches the email production
 of the following ABNF, the character set for which is Unicode. This ABNF
 implements the extensions described in
 RFC 1123. [ABNF] [RFC5322] [RFC1034] [RFC1123]

email         = 1*( atext / "." ) "@" label *( "." label )
label         = let-dig [ [ ldh-str ] let-dig ]  ; limited to a length of 63 characters by RFC 1034 section 3.5
atext         = < as defined in RFC 5322 section 3.2.3 >
let-dig       = < as defined in RFC 1034 section 3.5 >
ldh-str       = < as defined in RFC 1034 section 3.5 >
This requirement is a willful violation of RFC 5322, which defines a syntax
 for e-mail addresses that is simultaneously too strict (before the "@" character),
 too vague (after the "@" character), and too lax (allowing comments,
 whitespace characters, and quoted strings in manners unfamiliar
 to most users) to be of practical use here.

The following JavaScript- and Perl-compatible regular expression is an
 implementation of the above definition.

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

I'd be happy to submit a PR using the above proposed regular expression if you'd like, just let me know.

Thanks for an awesome validation library!

@nschonni
Copy link
Collaborator

Ping @scottgonzalez since the original rule is based off of your code

@scottgonzalez
Copy link

I think email validation is a total mess and the sanest thing to do today is use the HTML5 validation rules. A more detailed response can be seen in a Stack Overflow response I wrote earlier this year.

@jzaefferer
Copy link
Collaborator

Switched to using the HTML5 regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants