this post was submitted on 17 Sep 2026
13 points (100.0% liked)

FOSS - Freie Software

1420 readers
1 users here now

Deutschsprachige Community zum Austausch über Freie Software

Postet hier gerne News, Artikel, Empfehlungen und Fragen mit Bezug zu FOSS - Open Source - Freier Software…

Dies ist eine Lemmy-Community (Was ist Lemmy?) Wie Ihr auch von anderen Fediverse-Accounts aus teilnehmen könnt, ist auch hier beschrieben.

Bildquelle Icon: Colin Viebrock, CC BY 2.5 via Wikimedia Commons

#fedi22 #FOSS #OpenSource

Nachfolge von @foss_de@feddit.de

founded 2 years ago
MODERATORS
top 10 comments
sorted by: hot top controversial new old
[–] chickenf622@sh.itjust.works 6 points 4 weeks ago (1 children)

May want to out a warning on this tool that if your checking against a long list of strings you may want to use something else. A massive regex can be a huge performance bottleneck. I know from personally killing a production server by using an inefficient regex on large strings of data.

[–] rocket9@feddit.org 2 points 4 weeks ago* (last edited 4 weeks ago)

list2regexp will limit each regular expression to matching 10,000 entries by default. Matching against each pattern of 10,000 entries takes around 1 microsecond on a laptop. I've fed it several megabytes of IP addresses and it doesn't choke. That's kind of the point.

[–] rocket9@feddit.org 3 points 4 weeks ago (1 children)

Here is an example. Given the following list of strings:

1.2.3.4
127.0.0.1
127.0.0.2
127.0.0.11
128.0.0.1
125.0.0.*
200.0.0.1
2001:0db8:85a3:0000:0000:8a2e:0370:1300
2001:0db8:85a3:0000:0000:8a2e:0370:1330
2001:0db8:85a3:0000:0000:8a2e:0370:1337
あいうえお
あいうえこ
😃😁😆😐
😃😁😆
😃😁🤣

list2regexp will return the following pattern:

^(?:1(?:(?:\.(?:2(?:\.(?:3(?:\.(?:4))))))|(?:2(?:(?:5(?:\.(?:0(?:\.(?:0(?:\.(?:.*)))))))|(?:7(?:\.(?:0(?:\.(?:0(?:\.(?:(?:1(?:|(?:1)))|(?:2))))))))|(?:8(?:\.(?:0(?:\.(?:0(?:\.(?:1)))))))))))|(?:2(?:0(?:0(?:(?:\.(?:0(?:\.(?:0(?:\.(?:1))))))|(?:1(?::(?:0(?:d(?:b(?:8(?::(?:8(?:5(?:a(?:3(?::(?:0(?:0(?:0(?:0(?::(?:0(?:0(?:0(?:0(?::(?:8(?:a(?:2(?:e(?::(?:0(?:3(?:7(?:0(?::(?:1(?:3(?:(?:0(?:0))|(?:3(?:(?:0|7))))))))))))))))))))))))))))))))))))))))))|(?:あ(?:い(?:う(?:え(?:(?:お|こ))))))|(?:😃(?:😁(?:(?:😆(?:|(?:😐)))|(?:🤣))))$
[–] cows_are_underrated@feddit.org 2 points 4 weeks ago (2 children)

This regexp is literally the worst fucking thing I have ever seen. Please never ever use a regexp of that size ever in your production system.

[–] Paulemeister@feddit.org 2 points 4 weeks ago (1 children)

Congrats Frau Kuh, you got a special FAQ entry in the README just for you

[–] rocket9@feddit.org 1 points 4 weeks ago* (last edited 4 weeks ago)

As funny as that would be, this has been a surprisingly common misconception.

[–] rocket9@feddit.org 0 points 4 weeks ago* (last edited 4 weeks ago) (1 children)

This drive-by criticism is the worst fucking thing I have ever seen. Please never ever use drive-by criticism without any code or references which back up its claims to inform your opinion on others work.

[–] cows_are_underrated@feddit.org 2 points 4 weeks ago (1 children)

The reason this is horrible is because its absolutely horrible if you ever have to manually touch this regex ever again.

This was not meant as a way to criticise your tool, because it is cool what you did there, but using regexp of that size is something I would advise against in an production environment.

[–] rocket9@feddit.org 0 points 4 weeks ago* (last edited 4 weeks ago) (1 children)

So, your criticism is that machine-generated code can be hard to edit when a human needs to touch it. I don't see how that is relevant here, being human-legible or editable is not a stated goal of the project. Rather than lobbing criticism against any software which machine-generates code for machine consumption, it makes more sense to use your best judgement and choose the software which is right for your use-case. I don't even want to know why you would ever machine-generate a regexp from a list, not save the list, and then somehow need to edit the regexp without access to the original items. That's not a software problem.

[–] cows_are_underrated@feddit.org 2 points 3 weeks ago

Yeah its Kind of like that and I do have to admit, that my original comment was bad and that I should have specified it in the original comment.