• lseif
        link
        fedilink
        arrow-up
        8
        ·
        1 year ago

        /^[a-zA-Z_]\w*$/

        i think… most languages at least

        • anton@lemmy.blahaj.zone
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          That’s variables and keyword.

          If you have a regex for a languages keywords you can substract as they are closed under that operation.

          • lseif
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            good point. some languages (like rust) also support r# prefix to use a keyword as a variable also