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.
  • 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

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

    @nixCraft not to be that guy, but I've always wondered if this could be turned into a product or something

    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

      mahryekuh@hachyderm.ioM This user is from outside of this forum
      mahryekuh@hachyderm.ioM This user is from outside of this forum
      mahryekuh@hachyderm.io
      wrote last edited by
      #18

      @nixCraft If we ever get a Ten Commandments for programming, one of them should be:

      "Thou shalt not write thy own email regex."

      curiously@mastodon.auC 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

        endlessmason@hachyderm.ioE This user is from outside of this forum
        endlessmason@hachyderm.ioE This user is from outside of this forum
        endlessmason@hachyderm.io
        wrote last edited by
        #19

        @nixCraft
        At your point it might be easier to just search haveibeenpwned for the address

        1 Reply Last reply
        0
        • mahryekuh@hachyderm.ioM mahryekuh@hachyderm.io

          @nixCraft If we ever get a Ten Commandments for programming, one of them should be:

          "Thou shalt not write thy own email regex."

          curiously@mastodon.auC This user is from outside of this forum
          curiously@mastodon.auC This user is from outside of this forum
          curiously@mastodon.au
          wrote last edited by
          #20

          @mahryekuh @nixCraft I thought it was reserved as a karmic punishment,
          you shall be cast into the darkness with the regex nought to return until the email be atuned
          type stuff
          Or was that a nightmare. . .?

          1 Reply Last reply
          0
          • R relay@relay.an.exchange shared this topic
          • zephyrxero@layer8.spaceZ zephyrxero@layer8.space

            @nixCraft RegEx, almost always the wrong choice

            orb2069@mastodon.onlineO This user is from outside of this forum
            orb2069@mastodon.onlineO This user is from outside of this forum
            orb2069@mastodon.online
            wrote last edited by
            #21

            @zephyrxero @nixCraft
            "I should have used logic, but this keeps the complexity rating down."

            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

              romion00bie@mastodon.socialR This user is from outside of this forum
              romion00bie@mastodon.socialR This user is from outside of this forum
              romion00bie@mastodon.social
              wrote last edited by
              #22

              @nixCraft Unwanted Summonings in Cyberspace

              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

                simon@gotosocial.grnwds.ukS This user is from outside of this forum
                simon@gotosocial.grnwds.ukS This user is from outside of this forum
                simon@gotosocial.grnwds.uk
                wrote last edited by
                #23

                @nixCraft
                I gave up when I realised emojis were valid characters in email addresses.

                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

                  pedersen@mastodon.artP This user is from outside of this forum
                  pedersen@mastodon.artP This user is from outside of this forum
                  pedersen@mastodon.art
                  wrote last edited by
                  #24

                  @nixCraft The plural of "regex" is "regrets" 😄

                  1 Reply Last reply
                  0
                  • foo__@mastodon.socialF foo__@mastodon.social

                    @nixCraft regex might be hard, the email addresses RFC is "wild", cf.

                    Link Preview Image
                    Email is Easy

                    Everyone knows what an email address is, right?

                    favicon

                    e-mail.wtf (e-mail.wtf)

                    kasperd@westergaard.socialK This user is from outside of this forum
                    kasperd@westergaard.socialK This user is from outside of this forum
                    kasperd@westergaard.social
                    wrote last edited by
                    #25

                    The answer that quiz gives on question 7 is not how I read the RFC. I looked at both RFC 821 and RFC 5321, neither permits spaces in an unqouted local-part.

                    project1enigma@chaos.socialP 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

                      S This user is from outside of this forum
                      S This user is from outside of this forum
                      spacelifeform@infosec.exchange
                      wrote last edited by
                      #26

                      @nixCraft

                      Did you find the needle in the haystack yet? /s

                      1 Reply Last reply
                      0
                      • kasperd@westergaard.socialK kasperd@westergaard.social

                        The answer that quiz gives on question 7 is not how I read the RFC. I looked at both RFC 821 and RFC 5321, neither permits spaces in an unqouted local-part.

                        project1enigma@chaos.socialP This user is from outside of this forum
                        project1enigma@chaos.socialP This user is from outside of this forum
                        project1enigma@chaos.social
                        wrote last edited by
                        #27

                        @kasperd @foo__ @nixCraft

                        I'd think in a dot-atom spaces around the dot would be ok?

                        That's foo . (Comment) bar @ something . com

                        At least in "obsolete" syntax.

                        project1enigma@chaos.socialP 1 Reply Last reply
                        0
                        • project1enigma@chaos.socialP project1enigma@chaos.social

                          @kasperd @foo__ @nixCraft

                          I'd think in a dot-atom spaces around the dot would be ok?

                          That's foo . (Comment) bar @ something . com

                          At least in "obsolete" syntax.

                          project1enigma@chaos.socialP This user is from outside of this forum
                          project1enigma@chaos.socialP This user is from outside of this forum
                          project1enigma@chaos.social
                          wrote last edited by
                          #28

                          @kasperd @foo__ @nixCraft

                          Probably even with line folds.

                          project1enigma@chaos.socialP 1 Reply Last reply
                          0
                          • project1enigma@chaos.socialP project1enigma@chaos.social

                            @kasperd @foo__ @nixCraft

                            Probably even with line folds.

                            project1enigma@chaos.socialP This user is from outside of this forum
                            project1enigma@chaos.socialP This user is from outside of this forum
                            project1enigma@chaos.social
                            wrote last edited by
                            #29

                            @kasperd @foo__ @nixCraft

                            Depending on use case you could make a regex for a reasonable subset still as long as it's ok for you to reject some theoretically valid addresses.

                            project1enigma@chaos.socialP 1 Reply Last reply
                            0
                            • project1enigma@chaos.socialP project1enigma@chaos.social

                              @kasperd @foo__ @nixCraft

                              Depending on use case you could make a regex for a reasonable subset still as long as it's ok for you to reject some theoretically valid addresses.

                              project1enigma@chaos.socialP This user is from outside of this forum
                              project1enigma@chaos.socialP This user is from outside of this forum
                              project1enigma@chaos.social
                              wrote last edited by
                              #30

                              @kasperd @foo__ @nixCraft

                              (Ok, my previous example was RFC 5322, for headers, not 5321 for addresses as used in the SMTP transaction...)

                              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

                                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
                                #31

                                @nixCraft Either you use something simple like .*@.*\..* (at least an at-sign and a dot after it) and send an e-mail with an link or you will summon a debate war on if the complete e-mail standards should be followed or not.

                                And, if you choose to follow the standards, I have to warn you (and I guess some people had warned you already) that most e-mail servers do not follow the standard (like Cloudflare).

                                On the other hand, I just sent a message from "example+';DROP/**/TABLE/**/users;#"@gmail.com to example@some-domain-of-mine and it arrived. I hope you never need to deal with addresses like those.

                                kawazoe@transfem.socialK 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

                                  iliaf@infosec.exchangeI This user is from outside of this forum
                                  iliaf@infosec.exchangeI This user is from outside of this forum
                                  iliaf@infosec.exchange
                                  wrote last edited by
                                  #32

                                  @nixCraft My experience tells me that if you have a problem and you solve it with regular expressions, you have two problems.

                                  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

                                    negative12dollarbill@techhub.socialN This user is from outside of this forum
                                    negative12dollarbill@techhub.socialN This user is from outside of this forum
                                    negative12dollarbill@techhub.social
                                    wrote last edited by
                                    #33

                                    @nixCraft
                                    This reads like @cstross parody fiction and I mean that as a compliment.

                                    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

                                      pseudonym@mastodon.onlineP This user is from outside of this forum
                                      pseudonym@mastodon.onlineP This user is from outside of this forum
                                      pseudonym@mastodon.online
                                      wrote last edited by
                                      #34

                                      @nixCraft

                                      At least the ancient demon is bound to serve you, and not eat you until it provides you with a perfect email parsing library, right?

                                      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

                                        drangnon@hachyderm.ioD This user is from outside of this forum
                                        drangnon@hachyderm.ioD This user is from outside of this forum
                                        drangnon@hachyderm.io
                                        wrote last edited by
                                        #35

                                        @nixCraft https://regex101.com/ is your friend, your very very good friend

                                        1 Reply Last reply
                                        0
                                        • qgustavor@urusai.socialQ qgustavor@urusai.social

                                          @nixCraft Either you use something simple like .*@.*\..* (at least an at-sign and a dot after it) and send an e-mail with an link or you will summon a debate war on if the complete e-mail standards should be followed or not.

                                          And, if you choose to follow the standards, I have to warn you (and I guess some people had warned you already) that most e-mail servers do not follow the standard (like Cloudflare).

                                          On the other hand, I just sent a message from "example+';DROP/**/TABLE/**/users;#"@gmail.com to example@some-domain-of-mine and it arrived. I hope you never need to deal with addresses like those.

                                          kawazoe@transfem.socialK This user is from outside of this forum
                                          kawazoe@transfem.socialK This user is from outside of this forum
                                          kawazoe@transfem.social
                                          wrote last edited by
                                          #36

                                          @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 1 Reply Last reply
                                          0
                                          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