I didn't know about this so I tried testing it out. Yes, this is possible, but requires enabling a specific flag (x when it comes to regexp2) assuming the engine even supports this feature.
Those would be interesting features, but it currently only operates on plain text lists, or lists with wildcards (*) which are converted into regexp (.*), or lists with CIDR suffixes (127.0.0.0/24). You can disable escaping, but list2regexp doesn't understand the individual segments of regular expressions, so the result will probably be wrong.
With that said, the library being used to handle escaping and testing the generated patterns (regexp2) does expose the syntax tree so the information is available to do interesting things with, such as what you suggest.
Being pretty or short is not a goal of this project, nor do I see the value in such goals.
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))))))))))))))))))))))))))))))))))))))))))|(?:あ(?:い(?:う(?:え(?:(?:お|こ))))))|(?:😃(?:😁(?:(?:😆(?:|(?:😐)))|(?:🤣))))$
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))))))))))))))))))))))))))))))))))))))))))|(?:あ(?:い(?:う(?:え(?:(?:お|こ))))))|(?:😃(?:😁(?:(?:😆(?:|(?:😐)))|(?:🤣))))$
Joint Force will be available on Steam starting January 1st.
Joint Force is free software, as it is released under the GNU Affero General Public License.
Download the source code at https://codeberg.org/tslocum/jointforce
Boxcars is a free and open source application for playing backgammon online and offline.
- Steam page: https://store.steampowered.com/app/3182230/Boxcars/
- Source code: https://codeberg.org/tslocum/boxcars
- Website: https://bgammon.org/
This video complements the text tutorial at https://trevors-tutorials.com/0011-creating-and-loading-tilemaps-using-ebitengine/
Trevors-Tutorials.com is where you can find free programming tutorials. The focus is on Go and Ebitengine game development. Watch the channel introduction for more info.
This video complements the text tutorial at https://trevors-tutorials.com/0008-handling-mouse-and-touchscreen-input-using-ebitengine/
Trevors-Tutorials.com is where you can find free programming tutorials. The focus is on Go and Ebitengine game development. Watch the channel introduction for more info.
This video complements the text tutorial at https://trevors-tutorials.com/0006-adding-text-to-your-ebitengine-game/
Trevors-Tutorials.com is where you can find free programming tutorials. The focus is on Go and Ebitengine game development. Watch the channel introduction for more info.
This video complements the text tutorial at https://trevors-tutorials.com/0005-adding-obstacles-to-your-ebitengine-game/
Trevors-Tutorials.com is where you can find free programming tutorials. The focus is on Go and Ebitengine game development. Watch the channel introduction for more info.
This video complements the text tutorial at https://trevors-tutorials.com/0003-getting-started-with-ebitengine/
Trevors-Tutorials.com is where you can find free programming tutorials. The focus is on Go and Ebitengine game development. Watch the channel introduction for more info.