rfc3986
rfc3986 copied to clipboard
Document how to create a pattern to match any IP address hostname
trafficstars
Put it within abnf_regex, useful for libraries that need to determine if a host is an IP address or not (For IDNA encoding, for example).
Can we document this instead of providing it directly? abnf_regexp.IPv4_RE and abnf_regexp.IP_LITERAL_RE would be combined to provide this support and I'm not sure that it would be terrible for the consumers that want this to do something like:
from rfc3986 import anbf_regexp
ALL_IP_RE = "({}|{})".format(abnf_regexp.IPv4_RE, abnf_regexp.IP_LITERAL_RE)
There's no maintenance cost to adding it to the library except not accidentally removing/breaking it.
That seems acceptable to me.
Re-opening to track for our docs