• FizzyOrange
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    We use it for triaging test failure (running tens of thousands of tests for CPU design verification).

    That use is acceptable because it is purely informational. In general you should avoid regexes at all costs. They’re difficult to read, and easy to get wrong. Generally they are a very big red flag.

    Unfortunately they tend to get used where they shouldn’t due to lazy developers not parsing things properly.

    • Dropkick3038
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      5 months ago

      regexes are a well established solution for parsing strings. what exactly is the “proper” alternative you propose?

      • spartanatreyu
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        There are some tools/libraries that act as a front-layer over regex.

        They basically follow the same logic as ORMs for databases:

        1. Get rid of the bottom layer to make some hidden footguns harder to trigger
        2. Make the used layer closer to the way the surrounding language is used.

        But there’s no common standard, and it’s always language specific.

        Personally I think using linters is the best option since it will highlight the footguns and recommend simpler regexes. (e.g. Swapping [0-9] for \d)