日期:2014-05-17  浏览次数:20471 次

一个很简单的字符串切分问题
job***@apple.com
chenghai***@qq.com

让@左边的四个字符替换为 “*”

------解决方案--------------------
PHP code


$str = 'tstkfeacbcs@ss.cds';
echo preg_replace('/.{4}@/', '****@', $str);

//tstkfea****@ss.cds