$regex = '([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})';
$string = 'I am emailing to john@gmail.com and hoe@gmail.com but harris@live.com';
$newString = preg_replace($regex,'',$string);
我想用空字符串替换所有电子邮件地址,留下前两个。所以 $newString 应该是
I am emailing to john@gmail.com and hoe@gmail.com but
. 但徒劳无功。
我该怎么做....