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

                                    wyldphyre@mastodon.worldW This user is from outside of this forum
                                    wyldphyre@mastodon.worldW This user is from outside of this forum
                                    wyldphyre@mastodon.world
                                    wrote last edited by
                                    #37

                                    @nixCraft Can the daemon validate things for you?

                                    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

                                      strawhousepig@mastodon.socialS This user is from outside of this forum
                                      strawhousepig@mastodon.socialS This user is from outside of this forum
                                      strawhousepig@mastodon.social
                                      wrote last edited by
                                      #38

                                      @nixCraft now toss moving between BSD/macOS and GNU into the mix.

                                      1 Reply Last reply
                                      0
                                      • paco@infosec.exchangeP This user is from outside of this forum
                                        paco@infosec.exchangeP This user is from outside of this forum
                                        paco@infosec.exchange
                                        wrote last edited by
                                        #39

                                        @meeper JavaScript you say? The same person covered that too. This one made me want to punch my computer.

                                        Link Preview Image
                                        new Date("wtf")

                                        How well do you know JavaScript's Date class?

                                        favicon

                                        jsdate.wtf (jsdate.wtf)

                                        @nixCraft

                                        1 Reply Last reply
                                        0
                                        • S stealthytango@mastodon.world

                                          @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 This user is from outside of this forum
                                          d1@autistics.lifeD This user is from outside of this forum
                                          d1@autistics.life
                                          wrote last edited by
                                          #40

                                          @StealthyTango and it needs to be typed in a demonic font, or it won't work.

                                          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