• (nodebb)

    The user must do something? I don't think so. The user always has the option of leaving your website, turning the computer off, and going to the beach.

  • (nodebb)

    Oh great, another one who wants to punish poor john@uk...

  • Grammar Nazi (unregistered)

    Remy, the parenthetical comment contains a "they're"/"their" mistake.

  • JanVP (unregistered)

    "in all they're forms" -> their

  • Peter L (unregistered)

    I love the check that the address shouldn't end with a dot, since that kicks out the very valid [email protected]. variant.

  • Rob (unregistered) in reply to Mr. TA

    It says they must do theze things "for a response." If they don't want a response then, yes, they are free to leave. I don't think the statements are inaccurate.

  • (nodebb)

    Apparently the programmer heard that if you solve a problem with regex, you now have two problems, so they solved the problem with more problems.

  • (nodebb) in reply to Peter L

    Wait, an email address can end with a dot? Is [email protected]. just another way to write [email protected] or is it a different address?

    Addendum 2025-03-03 09:58: Looks like Cloudflare is protecting those sample email addresses. The question is whether the domain domain.tld. is different from domain.tld.

  • (nodebb) in reply to jkshapiro

    Looks like Cloudflare is protecting those sample email addresses

    Well, duh. You should have used [email protected]. and [email protected], as God and RFC 2606 intended.

  • (nodebb) in reply to jkshapiro

    I'm pretty sure they're equivalent. In DNS, ending a name with a dot makes it absolute instead of relative. But I don't think the hostname in mail is ever treated as relative, so a trailing dot is redundant.

  • Argle (unregistered)

    Beginner: email.contains('@');

    Intermediate: (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+

    Advanced: email.contains('@');

  • (nodebb)

    If I just saw "@uk..." or "@example.tld." in an email field, I'd say that's invalid, and 99% of the time I'd be right.

    These are not RFC 5322 compliant.

  • MRAB (unregistered)

    What does str.indexOf(at)==lstr do?

    If the character is present, indexOf returns its position, which will be in the range 0 to length - 1.

    lstr is the length of the string.

    Therefore, str.indexOf(at)==lstr will always be false.

    Similarly, str.indexOf(dot)==lstr will always be false.

  • validationAlert (unregistered) in reply to Ralf

    Validation is like crack to some programmers. If it's 99.9999999%, still don't. Even a syntactically valid address may not actually exist. And what's the chance that any user will ever accidentally omit the TLD and be saved by your cleverness? A typo that leave steh address syntactically valid is infinitely more likely, so design your app to be able to easily recover from that state and the benefit of obsessive validation becomes even smaller. Make inner peace with the fact you can't truly validate email and stop trying. Those 5 users will feel enough relief for a million.

  • Klimax (unregistered)

    I love how every attempt at showing some weird email variant ends up in failure…

  • Vilx- (unregistered) in reply to MRAB

    like an icing on a cake, this is the off-by-one error, hiding in plain sight.

  • (nodebb) in reply to Klimax

    I love how every attempt at showing some weird email variant ends up in failure…

    Similar to date processing or "legal name" processing. It's just a thorny problem with very few good worked solutions that nobody seems to discover without going through the pain of doing it the wrong way a few times.

  • (nodebb) in reply to validationAlert

    Well, there's one stunningly simple way to validate email addresses: send an email message to that address with a confirmation link and wait for the user to click the link.

    ... though I have seen some convincing arguments to put up an "are you sure" message up if the entered domain is close to one of the big email providers (eg., "@gamil.com") or if the local part is close to the name (eg, if I entered "[email protected]").

  • Officer Johnny Holzkopf (unregistered)
    Comment held for moderation.

Leave a comment on “An Alerting Validation”

Log In or post as a guest

Replying to comment #:

« Return to Article