• 7 Posts
  • 6 Comments
Joined 2 年前
cake
Cake day: 2024年10月1日

help-circle

  • 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.




  • 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))))))))))))))))))))))))))))))))))))))))))|(?:あ(?:い(?:う(?:え(?:(?:お|こ))))))|(?:😃(?:😁(?:(?:😆(?:|(?:😐)))|(?:🤣))))$