rfc3986 icon indicating copy to clipboard operation
rfc3986 copied to clipboard

Document how to create a pattern to match any IP address hostname

Open sethmlarson opened this issue 6 years ago • 3 comments
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).

sethmlarson avatar Dec 06 '18 14:12 sethmlarson

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.

sigmavirus24 avatar Apr 09 '20 12:04 sigmavirus24

That seems acceptable to me.

sethmlarson avatar Apr 09 '20 12:04 sethmlarson

Re-opening to track for our docs

sigmavirus24 avatar Apr 09 '20 15:04 sigmavirus24