note 39117 deleted from function.preg-match by tularis

From: Date: Thu, 03 Jul 2008 21:40:14 +0000
Subject: note 39117 deleted from function.preg-match by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141151@lists.php.net to get a copy of this message
Note Submitter: nico at kamensek dot de ---- As I did not find any working IPv6 Regexp, I just created one. Here is it: $pattern1 = '([A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}'; $pattern2 = '[A-Fa-f0-9]{1,4}::([A-Fa-f0-9]{1,4}:){0,5}[A-Fa-f0-9]{1,4}'; $pattern3 = '([A-Fa-f0-9]{1,4}:){2}:([A-Fa-f0-9]{1,4}:){0,4}[A-Fa-f0-9]{1,4}'; $pattern4 = '([A-Fa-f0-9]{1,4}:){3}:([A-Fa-f0-9]{1,4}:){0,3}[A-Fa-f0-9]{1,4}'; $pattern5 = '([A-Fa-f0-9]{1,4}:){4}:([A-Fa-f0-9]{1,4}:){0,2}[A-Fa-f0-9]{1,4}'; $pattern6 = '([A-Fa-f0-9]{1,4}:){5}:([A-Fa-f0-9]{1,4}:){0,1}[A-Fa-f0-9]{1,4}'; $pattern7 = '([A-Fa-f0-9]{1,4}:){6}:[A-Fa-f0-9]{1,4}'; patterns 1 to 7 represent different cases. $full is the complete pattern which should work for all correct IPv6 addresses. $full = "/^($pattern1)$|^($pattern2)$|^($pattern3)$ |^($pattern4)$|^($pattern5)$|^($pattern6)$|^($pattern7)$/";

« previous php.notes (#141151) next »