• conditional_soup@lemm.ee
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    5 days 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.

    • 9point6@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      5 days ago

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

    • Kissaki@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      arrow-down
      1
      ·
      5 days 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
        0
        ·
        5 days 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
          1
          ·
          3 days 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.

    • kameecoding@lemmy.world
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      5 days ago

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