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))))))))))))))))))))))))))))))))))))))))))|(?:あ(?:い(?:う(?:え(?:(?:お|こ))))))|(?:😃(?:😁(?:(?:😆(?:|(?:😐)))|(?:🤣))))$Why? 🤔
In my case, to efficiently match against a large number of IP addresses and IP address ranges:
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.Also of note. Regexlicensing.org has issued no licences to date for use of regex in production environments
Not much substance to their argument, mostly just whining. Funny website, though.


