if (preg_match('/^(?:25[0-5]|2[0-4]d|1dd|[1-9]d|d)(?:[.](?:25[0-5]|2[0-4]d|1dd|[1-9]d|d)){3}$/',$ip)){ return $ip ; } else if (preg_match('/^(((?=(?>.*?(::))(?!.+3)))3?|([dA-F]{1,4}(3|:(?!$)|$)|2))(?4){5}((?4){2}|((2[0-4]|1d|[1-9])?d|25[0-5])(.(?7)){3})z/i',$ip)){ return $ip ; } =========================== ip4 ip6 php 정규식
<? $aa="2001:0DB8:1000:0000:0000:0000:1111:2222"; $bb="192.168.0.200";
if (preg_match('/^(?:25[0-5]|2[0-4]d|1dd|[1-9]d|d)(?:[.](?:25[0-5]|2[0-4]d|1dd|[1-9]d|d)){3}$/',$bb)){ echo $bb ; }
if (preg_match('/^(((?=(?>.*?(::))(?!.+3)))3?|([dA-F]{1,4}(3|:(?!$)|$)|2))(?4){5}((?4){2}|((2[0-4]|1d|[1-9])?d|25[0-5])(.(?7)){3})z/i',$aa)){ echo $aa ; }
?>
|