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

    functionaldavid@mastodon.socialF This user is from outside of this forum
    functionaldavid@mastodon.socialF This user is from outside of this forum
    functionaldavid@mastodon.social
    wrote last edited by
    #12

    @nixCraft One thing I've learned over the years, is never try to validate an email address with regex !

    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

      xilokar@mamot.frX This user is from outside of this forum
      xilokar@mamot.frX This user is from outside of this forum
      xilokar@mamot.fr
      wrote last edited by
      #13

      @nixCraft

      Copy a relatively good existing one, then just prompt for "are you sure" if it fails to match.

      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
        stealthytango@mastodon.world
        wrote last edited by
        #14

        @nixCraft I think this is the right page from the Necronomicon: (?:[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])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-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])+)\])

        d1@autistics.lifeD 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

          freequaybuoy@mastodon.socialF This user is from outside of this forum
          freequaybuoy@mastodon.socialF This user is from outside of this forum
          freequaybuoy@mastodon.social
          wrote last edited by
          #15

          @nixCraft Ah, did the reghex by mistake huh?!

          1 Reply Last reply
          0
          • clemensprill@troet.cafeC clemensprill@troet.cafe

            @nixCraft Just take a predefined one from someone else. Creating such complex regex is a waste of time and never totally right 🫠.

            freequaybuoy@mastodon.socialF This user is from outside of this forum
            freequaybuoy@mastodon.socialF This user is from outside of this forum
            freequaybuoy@mastodon.social
            wrote last edited by
            #16

            @clemensprill @nixCraft Shhhhh! 🤫 Let the normies think we write them like wizards

            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

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