Use the url module instead of regex to get the port