• apparia@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      8
      arrow-down
      1
      ·
      2 days ago

      Holy overengineering, Batman. IP addresses of all things are trivially parseable into fixed-length byte sequences. Just do that and use a search tree. Or, IDK; this is an extremely solved problem, there are probably even better solutions out there – but I promise you text regex is involved in none of the good ones.

      Even for actual string matching, any decent regex engine will compile and optimise an alternation a|b|c|... better than this text wrangling will. Unless you have actual benchmarks showing this gives you an advantage with the engine you’re using, you’re just introducing complexity for no gain.

    • Helix 🧬@feddit.org
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      2 days ago

      It’s called “allowlist” and “denylist” nowadays as it’s easier to understand for non-native speakers and not racist.

      I feel like there’s an easier and faster way to match IP addresses than regex, e.g. the search tree apparia suggested. At least use bytes to match 😄

        • Helix 🧬@feddit.org
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          1
          ·
          1 day ago

          Yes, but does it really hurt you to make your software more accessible?

          What good arguments do you have for the term blacklist?

          “Denylist” is easier to understand and doesn’t spark discussions. Nobody will be offended, whether it’s technically correct to be offended or not.

          I’m not a person of colour but your answer still insults me, because it’s so tone deaf.