• NegativeLookBehind@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    24 days ago

    I found your email address:

    (?:[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])+)\])
    
  • MTK@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    23 days ago

    Downvoted so that everyone can know I’m cool since I understand regex better than the idiot who made that meme.

  • frezik@midwest.social
    link
    fedilink
    arrow-up
    1
    ·
    24 days ago

    It helps if you break it apart into its component parts. Which is like anything else, really, but we’ve all accepted that regexes are supposed to run together in an unreadable mess. No reason it has to be that way.

  • Skyrmir@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    24 days ago

    Never debug regex, just generate a new one. It’s not worth the hassle to figure out not only what it does, but what it was meant to do.

    Better yet, just write it out in code, and never use regex. Tis a stupid thing that never should have been made.

    • potustheplant@feddit.nl
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      24 days ago

      Hard disagree. The function regex serves in programs like Notepad++ can’t be easily replaced by “writing it out in code”. With a very small number of characters you can get complex search patterns and capturing groups. It’s hard to read but incredibly useful.

      • Skyrmir@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        arrow-down
        1
        ·
        24 days ago

        If you’re needing that level of complexity in a text file search, you already fucked up by putting the data in a text file. There’s a reason data file formats exist.

        • potustheplant@feddit.nl
          link
          fedilink
          arrow-up
          1
          ·
          24 days ago

          Not even close. Sometimes you can have a large text file where you need to do a find replace with a pattern. For example, in the translation world this can be a common occurrence for translation files (.xliff) or translation memories (.tmx).

          There’s a reason why this is widely used and it’s not because everyone else but you is dumb.

          • Skyrmir@lemmy.world
            link
            fedilink
            English
            arrow-up
            0
            arrow-down
            1
            ·
            24 days ago

            Turns out the million hours of coding put into SQL, makes it a better option than regex, even for xml based files.

            • potustheplant@feddit.nl
              link
              fedilink
              arrow-up
              1
              ·
              23 days ago

              Maybe for your very specific use case that’s true. However, other use cases exist and for many of those RegEx is the better option.

              • Skyrmir@lemmy.world
                link
                fedilink
                English
                arrow-up
                0
                arrow-down
                1
                ·
                23 days ago

                I’m saying if your use case makes regex the best option, you’ve gone the wrong way and should turn back. There are definitely corners you can paint yourself into that make it the way to go, but you’ve ended up there through a series of bad ideas.

                • potustheplant@feddit.nl
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  23 days ago

                  Maybe, just maybe, the context in which you use regex isn’t the same as everyone elses. But hey, who am I to deny you the disservice of thinking you’re the center of the world?