http://www.corange.cn/archives/2008/02/230.html
<?php
$str = '1.1.1.1';

$reg = '/((?:/d+/.){3})/d+/';

echo preg_replace($reg, "//1*", $str);
?>