Ec (2); & lt ;? Expire (thankstoWCP) functionvalidateIPv6 ($ IP) {& nbsp; returnpreg_match (A & nbsp; & nbsp ;(? : & Script ec (2); script
// Literally from the ABNF in rfc3986 (thanks to 'wcp ')
Function validateIPv6 ($ IP)
{
Return preg_match ('/
(? :
(? :
(? : [A-f0-9] {} :) {6}
|
::(? : [A-f0-9] {} :) {5}
|
(? : [A-f0-9 })? ::(? : [A-f0-9] {} :) {4}
|
(? :(? : [A-f0-9] {} :) {} [a-f0-9 })? ::(? : [A-f0-9] {} :) {3}
|
(? :(? : [A-f0-9] {} :) {} [a-f0-9 })? ::(? : [A-f0-9] {} :) {2}
|
(? :(? : [A-f0-9] {} :) {} [a-f0-9 })? : [A-f0-9 }:
|
(? :(? : [A-f0-9] {} :) {} [a-f0-9 })? ::
)
(? :
[A-f0-9] {}: [a-f0-9}
|
(? :(? : [0-9] | [1-9] [0-9] | 1 [0-9] [0-9] | 2 [0-4] [0-9] | 25 [0-5]).) {3}
(? : [0-9] | [1-9] [0-9] | 1 [0-9] [0-9] | 2 [0-4] [0-9] | 25 [0-5])
)
|
(? :
(? :(? : [A-f0-9] {} :) {} [a-f0-9 })? : [A-f0-9}
|
(? :(? : [A-f0-9] {} :) {} [a-f0-9 })? ::
)
) Z/ix ',
$ IP
);
}
?>