• Pleonasm@programming.dev
    link
    fedilink
    English
    arrow-up
    33
    ·
    1 year ago

    Who is this for? People who write lots of regular expressions won’t need it because they know what they’re doing and people who don’t write lots of regular expressions probably won’t find it anyway.

    It just seems like a weird type of user who actually wants this.

    • realitista@lemm.ee
      link
      fedilink
      English
      arrow-up
      29
      ·
      edit-2
      1 year ago

      I almost never use regex, but when I do, I’d love something like this. Exactly because I don’t use regex enough to be bothered learning it’s impenetrable syntax.

      • custom_situation@lemm.ee
        link
        fedilink
        English
        arrow-up
        7
        ·
        edit-2
        1 year ago

        i mean, you can learn the basics of matching in 30 minutes or less. that core knowledge will be broadly applicable across any tool that uses regex. things get much easier once to have a handle on the basics.

        …or you can learn this regex dsl and still have to learn regex. the difference is you’re learning a non-portable regex syntax.

        • IronDonkey@lemmy.world
          link
          fedilink
          English
          arrow-up
          6
          ·
          1 year ago

          You’re right, I can learn the basics of regex in 30 minutes. Then I can write my one regex. Then I can forget the basics of regex in 3 minutes, because regex’s syntax is random garbage that makes no intuitive sense, and I hate and suck at memorizing nonsense. Repeat every 4-16 months.

          It’s true though that regex is entrenched enough that even if something is easier to read, it’s unlikely that it’ll replace regex any time soon. You’d need a couple big names to adopt it, then many years.

          But if there’s a readable replacement that can convert to and from regex - well, screw it, I’m in. Even if I’m required to use regex in some program, if I can write something that makes sense without the requisite half hour of googling crap, I’ll just use it as a separate tool to make and read regex strings.

        • Kempeth@feddit.de
          link
          fedilink
          English
          arrow-up
          6
          ·
          1 year ago

          Sure. I just very rarely need just basic regexes.

          And once you go beyond these the syntax gets very obtuse. Which means I’m spending an hour+ googling something close to what I need and then using a sandbox to try and tweak it until it does what I need. Then I paste something into my code that I won’t understand anymore 5 minutes into the future - which isn’t exactly great for maintainability.

          • realitista@lemm.ee
            link
            fedilink
            English
            arrow-up
            3
            ·
            1 year ago

            This is a good point too. Just because you don’t use regex often doesn’t mean your needs are simple. They are probably much the same as someone who uses it often. Which is why readability and less learning curve is a good thing.

        • realitista@lemm.ee
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Probably I’ve spent the 30 minutes 5-10 times over my life. But then it’s a few years till I need it again and I need to spend the 30 minutes again.

      • NightAuthor@beehaw.org
        link
        fedilink
        English
        arrow-up
        7
        ·
        1 year ago

        I learned enough to see how powerful it was, then started using it within Sublime Text to edit data from time to time. (Extract URLs or something from a websites code, reformat X or Y data for a script I’m hacking together) and I’ve slowly retained more and more of the elements I repeatedly use. I think I’ve actually got a pretty good grasp on it. Maybe you should be using it more.

        • realitista@lemm.ee
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 year ago

          I’m not a programmer by trade so I only program when I need something and regex is a small subset of that. Usually I find something someone else wrote and adapt it to my needs. But it would be nice to be able to write things from scratch, this would be a helpful tool for that for sure.

        • Kempeth@feddit.de
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          When you want to get better using a hammer, just treat everything as a nail.

      • SloppyPuppy@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 year ago

        I just learned to type what I want from a regex in chatgpt and call it a day. It works pretty well.

        Also fuck regex.

    • curiousaur@lemmy.fmhy.ml
      link
      fedilink
      English
      arrow-up
      11
      ·
      1 year ago

      I think it’s for me. I occasionally need regular expressions, like any career programmer. I also hate regular expressions. I have to complely relearn the every time I use them.

    • Kempeth@feddit.de
      link
      fedilink
      English
      arrow-up
      5
      ·
      1 year ago

      me for example. I don’t write regex often enough to be really familar with the cryptic syntax. But I do use them every once in a while and dread the occasion every time. Having a more expressive way to write pattern matching instructions would be really useful to me.

      • Pleonasm@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 year ago

        But then you’ll have to learn the syntax of this instead.

        I suspect that if you actually start using Melody you won’t find it as helpful as you think you might. Maybe I’m wrong. Let’s see in a year’s time.

        • Kempeth@feddit.de
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          I mean it’s JS. I’m not touching that if I can help it. But what you describe is less of a problem with the concept and more one with an immature technology.

          • vrighter@discuss.tchncs.de
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            the way I see it, you seem to need to learn and understand all the same concepts as when using regex in order to write a functional pattern in this. It does not seem to really offer any abstractions really. It’s just regex with a really really verbose syntax. Once you learn the concepts (which you have to anyway) then learning a new syntax should be easy with a simple cheatsheet. The syntax for this actually looks more complicated to me.

    • minorninth@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      ·
      1 year ago

      OK, let’s say you’ve got a bunch of regexes in a source repository that need to get modified frequently. It can be difficult to code-review complex regexes, and even harder to code-review changes to an existing regex.

      Something like this might actually help. A change to a complex regex might actually produce a more clear diff of a subset of lines.

      Also, I think being able to comment in the middle of a regex would be super handy for that type of code.

      • Pleonasm@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        But you can do that already in many languages using extended Regex syntax.This doesn’t add anything except more verbosity and another syntax to learn.

    • Spzi@lemm.ee
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      It might be used in education. Some who learned it this way might stick to it, or advance to your first group.