From line 738 of functions_transfer.php
This regex will only match an IPv4 address. The other portions of phpBB support IPv6 addresses.
This looks like a complicated fix due to the way the port number is tacked onto the IP address. Maybe the port could be prepended instead of appended to keep it relatively simple.