• leanleft@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 day ago

    it should(could) have newlines for readability. and is genererally an underappreciated feature that leads to people thinking that regex is crazy and unreadable.

    • trevor@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 day ago

      I didn’t know about this so I tried testing it out. Yes, this is possible, but requires enabling a specific flag (x when it comes to regexp2) assuming the engine even supports this feature.

      • leanleft@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 day ago

        also comments. which can be very simple…like metadata about boundary,membership,grouping, or hierarchy.
        its supported in most languages except javascript and plain grep.
        but it doesnt serve a programmatic use… so even if its a hella useful single char or digit, that massively boosts readability… some people would argue that it’s extra/junk