• @d_k_bo@feddit.de
    link
    fedilink
    432 years ago

    I recommend using https://regex101.com/

    It explains all parts of your regex and highlights all matches in your example text. I usually add a comment to a regex101 playground if I use a regex in code.

    • Aniki 🌱🌿
      link
      fedilink
      English
      122 years ago

      regex101 is super useful once you already know regex but not for learning.

          • @FooBarrington@lemmy.world
            link
            fedilink
            172 years ago

            Does every Regex contain a reverse negative lookup? Do I need to know how to do a reverse negative lookup to write a Regex?

            If not, why are you asking?

            • Aniki 🌱🌿
              link
              fedilink
              English
              32 years ago

              Because learning a bit of regex isn’t the same thing as learning all of regex and the distinction is important.

              • @FooBarrington@lemmy.world
                link
                fedilink
                162 years ago

                I have written dozens upon dozens of Regexes without using reverse negative lookups, but I guess according to you I don’t really know Regexes because I haven’t used those specific features?

                You don’t need to know all about a subject to know a subject.

                • Aniki 🌱🌿
                  link
                  fedilink
                  English
                  3
                  edit-2
                  2 years ago

                  I’m not saying you’re not efficient. I’m saying if you look at my code, and I write a lot of negative lookups in dev ops for data validation, you can’t read my code. It’s nothing personal.

                  • @FooBarrington@lemmy.world
                    link
                    fedilink
                    72 years ago

                    I’m not sure why you’re bringing up efficiency, I’m not talking about that. If I don’t understand a topic, I can’t do things with the topic. I use Regexes, so I must at least somewhat understand Regexes.

                    I’m saying if you look at my code, and I write a lot of negative lookups in dev ops for data validation, you can’t read my code. It’s nothing personal.

                    Well, earlier you were saying that I don’t know Regexes if I don’t know reverse negative lookups. Funnily enough Regex101 would help me understand your code in this case, so you were wrong on that count too.

      • @doostein@beehaw.org
        link
        fedilink
        32 years ago

        I disagree. I found it to be incredibly useful when I knew what regex was and that I needed it, but I couldn’t piece together a single string with it.