Skip to main content
added 74 characters in body
Source Link
ruohola
  • 23.3k
  • 7
  • 70
  • 107

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.includes('@')

Or, if you need to support IE/older browsers:

email.indexOf("@"'@') > 0

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") > 0

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.includes('@')

Or, if you need to support IE/older browsers:

email.indexOf('@') > 0

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

fully reverted with >0 instead of 1
Source Link
CodingYourLife
  • 8.2k
  • 6
  • 58
  • 73

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") > 10

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") > 1

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") > 0

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

Rollback to Revision 5
Source Link
CodingYourLife
  • 8.2k
  • 6
  • 58
  • 73

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") ===> 1

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") === 1

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

All email addresses contain an 'at' (i.e. @) symbol. Test that necessary condition:

email.indexOf("@") > 1

Don't bother with anything more complicated. Even if you could perfectly determine whether an email is RFC-syntactically valid, that wouldn't tell you whether it belongs to the person who supplied it. That's what really matters.

To test that, send a validation message.

Rollback to Revision 4
Source Link
CodingYourLife
  • 8.2k
  • 6
  • 58
  • 73
Loading
sorry my initial suggestion was wrong because it's not a count but an indexOf occurance. I'd leave it that way tbh...
Source Link
CodingYourLife
  • 8.2k
  • 6
  • 58
  • 73
Loading
at sign should be exactly one and not one or more. no email should contain more than one at sign. also comment states that with 4 upvotes.
Source Link
CodingYourLife
  • 8.2k
  • 6
  • 58
  • 73
Loading
Updated answer
Source Link
Azeem
  • 13.5k
  • 4
  • 32
  • 45
Loading
local part needs to be at least 1 character long, therefore "@" may appear at position 1 or larger, NOT at the start
Source Link
Loading
Post Made Community Wiki by pera
Source Link
Colonel Panic
  • 136.2k
  • 94
  • 413
  • 474
Loading