@@ -705,6 +705,129 @@ Unacceptable input example:
705705foobar2001:db8::1
706706```
707707
708+ #### `Stdlib::IP::Address`
709+
710+ Matches any IP address, including both IPv4 and IPv6 addresses. It will
711+ match them either with or without an address prefix as used in CIDR
712+ format IPv4 addresses.
713+
714+ Examples:
715+
716+ ```
717+ '127.0.0.1' =~ Stdlib::IP::Address # true
718+ '8.8.4.4' =~ Stdlib::IP::Address # true
719+ '10.1.240.4/24' =~ Stdlib::IP::Address # true
720+ '52.10.10.141' =~ Stdlib::IP::Address # true
721+ '192.168.1' =~ Stdlib::IP::Address # false
722+ 'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address # true
723+ 'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address # true
724+ 'FF01::101' =~ Stdlib::IP::Address # true
725+ 'FF01:0:0:0:0:0:0:101/32' =~ Stdlib::IP::Address # true
726+ 'FF01::101/60' =~ Stdlib::IP::Address # true
727+ '::' =~ Stdlib::IP::Address # true
728+ '12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address # true
729+ ```
730+
731+ #### `Stdlib::IP::Address::V4`
732+
733+ Match any string consisting of an IPv4 address in the quad-dotted
734+ decimal format, with or without a CIDR prefix. It will not match any
735+ abbreviated form (e.g., 192.168.1) because these are poorly documented
736+ and inconsistently supported.
737+
738+ Examples:
739+
740+ ```
741+ '127.0.0.1' =~ Stdlib::IP::Address::V4 # true
742+ '8.8.4.4' =~ Stdlib::IP::Address::V4 # true
743+ '10.1.240.4/24' =~ Stdlib::IP::Address::V4 # true
744+ '52.10.10.141' =~ Stdlib::IP::Address::V4 # true
745+ '192.168.1' =~ Stdlib::IP::Address::V4 # false
746+ 'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V4 # false
747+ '12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V4 # false
748+ ```
749+
750+ #### `Stdlib::IP::Address::V6`
751+
752+ Match any string consistenting of an IPv6 address in any of the
753+ documented formats in RFC 2373, with or without an address prefix.
754+
755+ Examples:
756+
757+ ```
758+ '127.0.0.1' =~ Stdlib::IP::Address::V6 # false
759+ '10.1.240.4/24' =~ Stdlib::IP::Address::V6 # false
760+ 'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V6 # true
761+ 'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address::V6 # true
762+ 'FF01::101' =~ Stdlib::IP::Address::V6 # true
763+ 'FF01:0:0:0:0:0:0:101/32' =~ Stdlib::IP::Address::V6 # true
764+ 'FF01::101/60' =~ Stdlib::IP::Address::V6 # true
765+ '::' =~ Stdlib::IP::Address::V6 # true
766+ '12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V6 # true
767+ ```
768+
769+ #### `Stdlib::IP::Address::Nosubnet`
770+
771+ Match the same things as the `Stdlib::IP::Address` alias, except it will not
772+ match an address that includes an address prefix (e.g., it will match
773+ `192.168.0.6` but not `192.168.0.6/24`).
774+
775+ #### `Stdlib::IP::Address::V4::CIDR`
776+
777+ Match an IPv4 address in the CIDR format. It will only match if the
778+ address contains an address prefix (e.g., it will match `192.168.0.6/24`
779+ but not `192.168.0.6`).
780+
781+ #### `Stdlib::IP::Address::V4::Nosubnet`
782+
783+ Match an IPv4 address only if the address does not contain an address
784+ prefix (e.g., it will match `192.168.0.6` but not `192.168.0.6/24`).
785+
786+ #### `Stdlib::IP::Address::V6::Full`
787+
788+ Match an IPv6 address formatted in the "preferred form" as documented in
789+ section 2.2.1 of RFC 2373, with or without an address prefix as
790+ documented in section 2.3 of RFC 2373.
791+
792+ #### `Stdlib::IP::Address::V6::Alternate`
793+
794+ Match an IPv6 address formatted in the "alternative form" allowing for
795+ representing the last two 16-bit pieces of the address with a
796+ quad-dotted decimal, as documented in section 2.2.1 of RFC 2373. It will
797+ match addresses with or without an address prefix as documented in
798+ section 2.3 of RFC 2373.
799+
800+ #### `Stdlib::IP::Address::V6::Compressed`
801+
802+ Match an IPv6 address which may contain `::` used to compress zeros as
803+ documented in section 2.2.2 of RFC 2373. It will match addresses with
804+ or without an address prefix as documented in section 2.3 of RFC 2373.
805+
806+ #### `Stdlib::IP::Address::V6::Nosubnet`
807+
808+ Alias to allow `Stdlib::IP::Address::V6::Nosubnet::Full`,
809+ `Stdlib::IP::Address::V6::Nosubnet::Alternate` and
810+ `Stdlib::IP::Address::V6::Nosubnet::Compressed`.
811+
812+ #### `Stdlib::IP::Address::V6::Nosubnet::Full`
813+
814+ Match an IPv6 address formatted in the "preferred form" as documented in
815+ section 2.2.1 of RFC 2373. It will not match addresses with address
816+ prefix as documented in section 2.3 of RFC 2373.
817+
818+ #### `Stdlib::IP::Address::V6::Nosubnet::Alternate`
819+
820+ Match an IPv6 address formatted in the "alternative form" allowing for
821+ representing the last two 16-bit pieces of the address with a
822+ quad-dotted decimal, as documented in section 2.2.1 of RFC 2373. It will
823+ only match addresses without an address prefix as documented in section
824+ 2.3 of RFC 2373.
825+
826+ #### `Stdlib::IP::Address::V6::Nosubnet::Compressed`
827+
828+ Match an IPv6 address which may contain `::` used to compress zeros as
829+ documented in section 2.2.2 of RFC 2373. It will only match addresses
830+ without an address prefix as documented in section 2.3 of RFC 2373.
708831
709832### Facts
710833
0 commit comments