Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. me: i need to validate some email addresses, so i am going to write a quick regex.

me: i need to validate some email addresses, so i am going to write a quick regex.

Scheduled Pinned Locked Moved Uncategorized
44 Posts 37 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • foo__@mastodon.socialF This user is from outside of this forum
    foo__@mastodon.socialF This user is from outside of this forum
    foo__@mastodon.social
    wrote last edited by
    #41

    @grepe was posted by someone on mastodon, I don't remember who 🙂 @nixCraft

    1 Reply Last reply
    0
    • nixcraft@mastodon.socialN nixcraft@mastodon.social

      me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?

      *4 hours later*
      me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck

      jhelou@mamot.frJ This user is from outside of this forum
      jhelou@mamot.frJ This user is from outside of this forum
      jhelou@mamot.fr
      wrote last edited by
      #42

      @nixCraft Everytime someone uses a regex to validate an email, god kills truckloads of kittens

      Split on last @ ensuring the previous character is not itself an @

      Check if the domain part resolves, make sure you allow for international domain names.

      You can check if the localpart is well formed. IIRC this is not possible with regexes. You need a parser.

      With a valid domain, sending an email is the only real way to verify if the address is actually valid. Well formed doesn't mean accepted.

      1 Reply Last reply
      0
      • nixcraft@mastodon.socialN nixcraft@mastodon.social

        me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?

        *4 hours later*
        me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck

        makini@mastodon.socialM This user is from outside of this forum
        makini@mastodon.socialM This user is from outside of this forum
        makini@mastodon.social
        wrote last edited by
        #43

        @nixCraft Reminded of this old gem:

        Link Preview Image
        1 Reply Last reply
        0
        • kawazoe@transfem.socialK kawazoe@transfem.social

          @qgustavor@urusai.social @nixCraft@mastodon.social you have successfully summoned a debate war by forgetting that user@localhost is a valid email, so is user@::1, and any other locally resolved name and ipv6 address. Just containing a @ is more than enough if you already try to send an email to it. 😉

          Seriously though, enforcing a dot in the domain is probably reasonable for most publicly accessible email servers.

          qgustavor@urusai.socialQ This user is from outside of this forum
          qgustavor@urusai.socialQ This user is from outside of this forum
          qgustavor@urusai.social
          wrote last edited by
          #44

          @kawazoe @nixCraft I got my share of self-hosted things that don't allow using localhost as the domain (e.g. Pocketbase). ::1 I guess it's invalid, it should be user@[::1]. I have a sending email address that works (sometimes) with four at-signs.

          1 Reply Last reply
          0
          • R relay@relay.infosec.exchange shared this topic
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups