$s = 'aaa.bbb.ccc.ddd...';
如何用正则替换成a.b.c.d...
------解决方案--------------------
- PHP code
$s = 'aaa.bbb.ccc.ddd...'; echo preg_replace('/([a-z])+/i','\1',$s);
------解决方案--------------------
$s = 'aaa.bbb.ccc.ddd...';
echo preg_replace('/(\w)+/', '$1', $s); //a.b.c.d...