I want to filter those messages ( a long text string ) if it contains any personal information ( email ) in PHP. Is there a built-in function in PHP or if anybody has experienced filtering like this, I would be thankful with.
Thanks !
I want to filter those messages ( a long text string ) if it contains any personal information ( email ) in PHP. Is there a built-in function in PHP or if anybody has experienced filtering like this, I would be thankful with.
Thanks !
You can search and replace emails with another string:
$str = preg_replace('/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})/', '[censored]', $str);