If you really donโt need IP address validation, I suggest you simplify the regular expression because this beast is too complex to match only the โIP partโ and โport partโ. My suggestion would be
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})
Groups 1 and 2 will contain IP and port, respectively. And above it is already more difficult what it should be, IMHO even something simple, as it would be enough:
(\d+\.\d+\.\d+\.\d+):(\d+)
Note that double backslashes are the requirements of Java strings, not regular expressions, so I left them out.
source share