Build, test, and debug regular expressions
This regular expression extracts the hostname and an optional port number from the beginning of a URL. It supports common protocols like HTTP, HTTPS, FTP, and FTPS, as well as IPv6 addresses enclosed in brackets. The matched host and port are captured in named groups `url_host` and `url_port`, making it useful for parsing network addresses or validating input.