I m looking for a way to remove any phone number and E-mail adress from a string.
Is anybody who have already realize that kind of function ?
What do you all recommand ? EREG ?
Thanks Regards, Titus.
PS: any tuto is huge welcomed :)
$chaine = "Here is my e-Mail contact@domain.eu and my phone (works) 0606060606 (not works) 06.06.06.06.06";
// Phone Number :
$chaine = preg_replace('/\+?[0-9][0-9()-\s+]{4,20}[0-9]/', '[removed]', $chaine);
// E-mail adress :
$pattern = "/[^@\s]*@[^@\s]*\.[^@\s]*/";
$replacement = "[removed]";
preg_replace($pattern, $replacement, $chaine);
echo $chaine;