Previous: , Up: Common Patterns   [Contents][Index]


A.4.4 Addresses

IPv4 Address
dec-octet     [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]
IPv4address   {dec-octet}\.{dec-octet}\.{dec-octet}\.{dec-octet}
IPv6 Address
h16           [0-9A-Fa-f]{1,4}
ls32          {h16}:{h16}|{IPv4address}
IPv6address   ({h16}:){6}{ls32}|
              ::({h16}:){5}{ls32}|
              ({h16})?::({h16}:){4}{ls32}|
              (({h16}:){0,1}{h16})?::({h16}:){3}{ls32}|
              (({h16}:){0,2}{h16})?::({h16}:){2}{ls32}|
              (({h16}:){0,3}{h16})?::{h16}:{ls32}|
              (({h16}:){0,4}{h16})?::{ls32}|
              (({h16}:){0,5}{h16})?::{h16}|
              (({h16}:){0,6}{h16})?::

See RFC 2373 for details. Note that you have to fold the definition of IPv6address into one line and that it also matches the “unspecified address” “::”.

URI

(([^:/?#]+):)?("//"([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?

This pattern is nearly useless, since it allows just about any character to appear in a URI, including spaces and control characters. See RFC 2396 for details.