• conditional_soup@lemm.ee
    link
    fedilink
    arrow-up
    114
    arrow-down
    9
    ·
    edit-2
    1 day ago

    Regex

    Edit: to everyone who responded, I use regex infrequently enough that the knowledge never really crystalizes. By the time I need it for this one thing again, I haven’t touched it in like a year.

    • LeninOnAPrayer@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      14 hours ago

      I just use the regex101 site. I don’t need anything too complicated ever. Has all the common syntax and shows matches as you type. Supports the different languages and globals.

    • dirtycrow@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      14 hours ago

      For me I spent one hour of ADHD hyper focusing to get the gist of regex. Python.org has good documentation. It’s been like 2 years so I’ve forgotten it too lol.

    • 9point6@lemmy.world
      link
      fedilink
      arrow-up
      37
      ·
      1 day ago

      You get used to it, I don’t even see the code—I just see: group… pattern… read-ahead…

    • kameecoding@lemmy.world
      link
      fedilink
      arrow-up
      32
      arrow-down
      1
      ·
      1 day ago

      Most of regex is pretty basic and easy to learn, it’s the look ahead and look behind that are the killers imo

        • activ8r@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          11 hours ago

          I know that LLMs are probably very helpful for people who are just getting started, but you will never understand it if you can’t grasp the fundamentals. Don’t let “AI” make you lazy. If you do use LLMs make sure you understand the output it’s giving you enough to replicate it yourself.

          This may not be applicable to you specifically, but I think this is nice info to have here for others.

          • TheEighthDoctor@lemmy.zip
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 hours ago

            I have no interest in learning regex ever in my life, I have better things to dedicate my brain capacity to haha

    • Kissaki@programming.dev
      link
      fedilink
      English
      arrow-up
      13
      arrow-down
      1
      ·
      1 day ago

      You always forget regex syntax?

      I’ve always found it simple to understand and remember. Even over many years and decades, I’ve never had issues reading or writing simple regex syntax (excluding the flags and shorthands) even after long regex breaks.

      • Akito@lemmy.zip
        link
        fedilink
        English
        arrow-up
        14
        ·
        1 day ago

        It’s not about the syntax itself, it’s about which syntax to use. There are different ones and remembering which one is for which language is tough.

        • Lehmanator@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          41 minutes ago

          This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

          The hardest part is remembering whether you need to use \w or [:alnum:].

          Way too few utils actually mention which syntax they use too. Most just say something accepts a “regular expression”, which is totally ambiguous.

        • Lehmanator@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          41 minutes ago

          This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

          The hardest part is remembering whether you need to use \w or [:alnum:].

          Way too few utils actually mention which syntax they use too. Most just say something accepts a “regular expression”, which is totally ambiguous.

        • Lehmanator@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          41 minutes ago

          This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

          The hardest part is remembering whether you need to use \w or [:alnum:].

          Way too few utils actually mention which syntax they use too. Most just say something accepts a “regular expression”, which is totally ambiguous.

        • Lehmanator@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          41 minutes ago

          This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

          The hardest part is remembering whether you need to use \w or [:alnum:].

          Way too few utils actually mention which syntax they use too. Most just say something accepts a “regular expression”, which is totally ambiguous.

          • ewenak@jlai.lu
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            1 day ago

            There is the “very magic” mode for vim regexes. It’s not the exact PCRE syntax, but it’s pretty close. You only need to add \v before the expression to use it. There is no permanent mode / option though. (I think you can remap the commands, like / to /\v)