you are viewing a single comment's thread
view the rest of the comments
[–] 22 points 1 month ago (6 children)

*sees rfc822 in a regular expression*

I bet that's the email specification. That's probably an email address parser.

*checks*

Yep.

  • source
  • hideshow 6 child comments
  • [–] 11 points 1 month ago (5 children)

    Perhaps worth adding that verifying an e-mail address via regex is difficult and not actually that useful.

    Difficult, because a lot of e-mail addresses are syntactically valid. For example, a@b is valid. As is a@1.2.3.4. As is "spaces are cool 😎"@b (with the quotes).

    And it's not that useful, because you need to send out an e-mail either way, if you want to know that it's the correct address and the user has access to it. A regex can't catch a typo in the actual words, for example.

    If you want a basic sanity check to catch when the user types their name into the e-mail field, then you can require that it contains an @ and, if you want, that there's at least one symbol before and after.
    If you go beyond that, you either need a massive regex or you're going to lock out users with unusual e-mail addresses.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 5 points 1 month ago (4 children)

    Yep, these email address validation tools are the bane of my existence. I use a non-typical TLD and it sometimes gets flagged as invalid because it's not .com, .net, or .org.

  • source
  • parent
  • hideshow 4 child comments