Agile Seller Messages - Option to Remove Phone & Emails
Posted: Sat Jan 14, 2017 9:29 pm
Add an option to choose to remove phone and email addresses from messages
- Code: Select all
function removeEmailAndPhoneFromString($string) {
// remove email
$string = preg_replace('/([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/','',$string);
// remove phone
$string = preg_replace('/([0-9]+[\- ]?[0-9]+)/','',$string);
return $string;
}
echo removeEmailAndPhoneFromString('Lorem ipsum [email protected] dolor sit amet, 37011116546 consectetur adipiscing elit.');