[TYPO3-core] RFC: Bug 331: Support IPv6 addresses

Franz Holzinger franz at fholzinger.com
Tue Mar 7 21:42:33 CET 2006


Hello Michael,

>  
>
>>>+     function validIPv6($ip) {
>>>+             $uppercaseIP = strtoupper($ip);
>>>+
>>>+             $regex = "/^(";
>>>+             $regex.= "(([\dA-F]{1,4}:){7}[\dA-F]{1,4})|";
>>>+             $regex.= "(([\dA-F]{1,4}){1}::([\dA-F]{1,4}:){1,5}[\dA-F]{1,4})|";
>>>+             $regex.= "(([\dA-F]{1,4}:){2}:([\dA-F]{1,4}:){1,4}[\dA-F]{1,4})|";
>>>+             $regex.= "(([\dA-F]{1,4}:){3}:([\dA-F]{1,4}:){1,3}[\dA-F]{1,4})|";
>>>+             $regex.= "(([\dA-F]{1,4}:){4}:([\dA-F]{1,4}:){1,2}[\dA-F]{1,4})|";
>>>+             $regex.= "(([\dA-F]{1,4}:){5}:([\dA-F]{1,4}:){0,1}[\dA-F]{1,4})|";
>>>+             $regex.= "(::([\dA-F]{1,4}:){0,6}[\dA-F]{1,4})";
>>>+             $regex.= ")$/";
>>> 
>>>
>>>      
>>>
>>I think it should be possible to find a more simple regular expression
>>for that.
>>    
>>
>
>How? Please make a suggestion if you know how to optimize this.
>
>  
>

See the attached file for the algorithm and test data.

+1 if you use this.


Greets,

Franz





-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipv6-test.php
Type: application/x-php
Size: 1153 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060307/c65e087c/attachment.bin 


More information about the TYPO3-team-core mailing list