• mayoi@sh.itjust.works
    cake
    link
    fedilink
    arrow-up
    1
    arrow-down
    12
    ·
    1 year ago

    I am, and I can think of many cases where plain dumb string matching since you know what you’re dealing with beats regex in both performance and maintainability.

    You’re a clown that wouldn’t know how to compare two strings without regex even if you got paid 6 figures to do it.

    • rwhitisissle@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      There’s a lot of use cases where regex makes a lot of sense: complex log parsing, determining if a value entered is a valid phone number or email, syntax highlighting, data validation in ML preprocessing, etc. A lot of languages also come with certain features that allow regex to be more efficient than dumb string matching, such as the ability to pre-compile patterns and the flexibility of being able to choose between deterministic and non-deterministic finite automata, should you need efficiency for one use case and flexibility for another. It really depends on what you’re designing and how it’s going to be used, of course.