Reepay
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
trevor@lemmy.ml to Open Source@lemmy.mlEnglish · 21 days ago

Announcing list2regexp - Generate regular expressions to match lists of strings

codeberg.org

external-link
message-square
6
link
fedilink
0
external-link

Announcing list2regexp - Generate regular expressions to match lists of strings

codeberg.org

trevor@lemmy.ml to Open Source@lemmy.mlEnglish · 21 days ago
message-square
6
link
fedilink
list2regexp
codeberg.org
external-link
Generate regular expressions to match lists of strings
  • Helix 🧬@feddit.org
    link
    fedilink
    English
    arrow-up
    0
    ·
    21 days ago

    Why? 🤔

    • trevor@lemmy.mlOP
      link
      fedilink
      arrow-up
      0
      ·
      21 days ago

      In my case, to efficiently match against a large number of IP addresses and IP address ranges:

      https://codeberg.org/tslocum/sriracha/src/commit/5bf24b0daabd058c2714427da17c7ea16b7cd43a/internal/server/server.go#L447

      • apparia@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        0
        ·
        21 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.

        • MadPsyentist@lemmy.nz
          link
          fedilink
          English
          arrow-up
          0
          ·
          20 days ago

          Also of note. Regexlicensing.org has issued no licences to date for use of regex in production environments

          https://regexlicensing.org/license/

          • trevor@lemmy.mlOP
            link
            fedilink
            arrow-up
            0
            arrow-down
            1
            ·
            20 days ago

            Not much substance to their argument, mostly just whining. Funny website, though.

Open Source@lemmy.ml

opensource@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !opensource@lemmy.ml

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

  • Open Source Initiative
  • Free Software Foundation
  • Electronic Frontier Foundation
  • Software Freedom Conservancy
  • It’s FOSS
  • Android FOSS Apps Megathread

Rules

  • Posts must be relevant to the open source ideology
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

  • !libre_culture@lemmy.ml
  • !libre_software@lemmy.ml
  • !libre_hardware@lemmy.ml
  • !linux@lemmy.ml
  • !technology@lemmy.ml

Community icon from opensource.org, but we are not affiliated with them.

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 414 users / day
  • 1.79K users / week
  • 2.95K users / month
  • 2.98K users / 6 months
  • 1 local subscriber
  • 49.4K subscribers
  • 127 Posts
  • 1.07K Comments
  • Modlog
  • mods:
  • Evan@lemmy.ml
  • kevincox@lemmy.ml
  • CrypticCoffee@lemmy.ml
  • Lettuce eat lettuce@lemmy.ml
  • BE: 0.19.20
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org