Regular expression to validate InetSocketAddresses (ipv4/v6 + port addresses)
问题 I am looking for tested regular expressions for both ipv4 and ipv6 InetSocketAddress (i.e., ip address + port number). I am not interested in validating hostnames. It can be two regex (one for ipv4, one for ipv6) or one combined regex. Does anyone have any to share? EDIT For ip4 format information see here, for ipv6 format information see here. Then, port number is added with ':'. EDIT 2 To create a string representation, I will proceed like this: byte[] tmp = { 10, 1, 0, 0 };