[Typo3-dev] IPv6 integration for Typo3
Sven Wilhelm
wilhelm at icecrash.com
Sun Sep 19 22:51:55 CEST 2004
Hi Marting,
> Sven, I think a simple split/count check would be faster, or at least
> easier to read then this regexp.
Don't know if that really works well with v6.
Examples for valid addresses(the easiest):
FEDC:BA98:7654:3210:FEDC:BA98:7654:3210
FEDC:BA98::3210:FEDC:BA98:7654:3210
FEDC:BA98::7654:3210
FEDC::7654:3210
::7654:3210
1080:0:0:0:8:800:200C:417A
FF01:0:0:0:0:0:0:101
0:0:0:0:0:0:0:1
0:0:0:0:0:0:0:0
1080::8:800:200C:417A
FF01::101
::1
The regex is only dirty to read on that site. In code
$regex = "/^(";
/* matching FFFF::FFFF:FFFF:FFFF:FFFF:FFFF */
$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 .= ")$/";
Won't come in 3.7, don't be afraid ;)
Greetings Sven
More information about the TYPO3-dev
mailing list