• TerrorBite :veripawed3:@meow.social
    link
    fedilink
    arrow-up
    6
    ·
    1 year ago

    I am of the opinion that regex for email address is a bad idea. The only two things that you need to check an email address are:

    Does the address contain an @ symbol?
    Is there a dot to the right of the @ symbol?

    Then just try to deliver to it, and let the MTA do the rest.

    Email addresses can be complicated, and there’s plenty of valid addresses that can be excluded by attempts at regex validation.

    @custom_situation @yoavlavi

    • Zikeji@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      I agree. In fact, the only check is if it contains the @ symbol, since “com” and other TLDs/gTLDs can have MX records, it is possible to have email@com. Not that we’d ever see it in practice though.

      • TerrorBite :veripawed3:@meow.social
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        @Zikeji It’s possible for TLDs to have A records, and for a while there were a few that did. But ICANN forbids top level A records, and I wouldn’t be surprised if they forbid top level MX records as well.

        Anyway, you would literally enter the address as “email@com.” including the trailing dot, which represents the DNS root that contains all the TLDs. You can also think of the trailing dot as an indicator of a FQDN (instead of a hostname within your local search domain).

    • custom_situation@lemm.ee
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      i said “email” but what i meant was “show me a complicated example”. i don’t disagree with anything you said.