46
submitted 4 days ago by trevor@lemmy.ml to c/opensource@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] thingsiplay@lemmy.ml 3 points 4 days ago

Is the goal to match ONLY the given haystack? What would be the use case? Because usually for dynamic usage you need the opposite site, find matches not the pattern. This is basically a pattern finder. Don't get me wrong, from technical level this is impressive and interesting. But I don't see a use case right now.

Well I could imagine a scenario to create test cases for your software that uses regex. But the resulting pattern is unreadable and probably not very efficient too. I don't have a better solution to this, so don't take my reply as a poison; I just analyze with interest.

[-] GenderNeutralBro@lemmy.sdf.org 3 points 4 days ago

I have lots of places I can use regex to match strings, but otherwise have no easy way to say "match any in list".

Is it stupid? Sure. But I can't fix the umpteen web consoles I manage; I have to work with them as they are.

[-] HotChickenFeet@sopuli.xyz 3 points 4 days ago* (last edited 4 days ago)

(?: strings|stringb|stringc)

Is valid regex given a list of strings to match, no?

Is the advantage here some performance gain or potential to use fewer characters depending on the list?

Edit: I see elsewhere it's specifically so you can match against a long list of specific IPs - so maybe a bit of both.

[-] thingsiplay@lemmy.ml 2 points 4 days ago

I see. Even if I have no use case for it personally, I want you to thank you for sharing. Its probably a niche use case, but always interesting to see what problems others try to solve and how they did it. The code is actually smaller than I expected.

this post was submitted on 17 Sep 2026
46 points (97.9% liked)

Open Source

49130 readers
754 users here now

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

Useful Links

Rules

Related Communities

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

founded 7 years ago
MODERATORS