@DeveloperMemes you can't validate email addresses anyway because many of them don't follow rfc rules

@DeveloperMemes wouldn't any valid mail address have to be at least 5 characters? a@b.c

@kolya @DeveloperMemes more actually, but the code there is just a joke. using that, @@@@ would be a valid email address

@Haijo7 @DeveloperMemes I think the point they are trying to make is that you should not do email validation and instead just sent a validation mail.

@kolya @DeveloperMemes yea, the code is correct, only the caption says "at least 4" heh

@kolya @DeveloperMemes That's what the code is checking, "email" has to be longer than 4.

@kolya @DeveloperMemes (the condition on the pic is right but the error message is not)

@DeveloperMemes The error message should be "[…] at least 5 characters […]" (>4), not "[…] at least 4 characters […]" (≥4)

@DeveloperMemes

Strictly speaking, the check is wrong, as it will not consider a@b a valid address, nor a@xy - both of which are.

The check should be email.includes('@') && email.length >= 3. That is true for every valid email address, and it is false only for invalid ones.

@bjc @DeveloperMemes Yes, but the goal of the check is to let every valid address through, and only stop invalid ones. Not every invalid address, but only invalid ones.

Some invalid ones will slip through, and those will be caught by not being deliverable.

@algernon @DeveloperMemes ah, i misread "true for every valid address" as "only true for valid addresses".

i think my mind managed to turn a description of a disjoint set into one with an intersection describing valid addresses.

brains are funny things
Sign in to participate in the conversation
Mastodon

cybre.town is an instance of Masterdon, a decentrialized and open source social media plattform. This instance is especially about tech/cyber stuff and is also available inside the tor network. - The name is inspired by cybre.space.