I have this function below:
function filterEmail($text)
{
return preg_replace('/(.*)[a-z0-9\.\_\-]+@[a-z0-9\.\_\-]+\.[a-z]+(.*)/i','', $text);
}
It removes lines who own e-mail.
I have a textarea
, and sometimes the users put the email, so whenever they put the email, this function removes.
Ex: Hello everyone, how are you?
I really liked the site.
Send me an email [email protected]
With this function, the content looks like this:
Ex: Hello, guys, how are you? I really liked the site.
So far so good. What I need is the same function, but also remove URL. If possible using preg_replace
.
And finally, sometimes users put three breaks of lines (\n\n)
- I need every time I put three breaks of lines (or more), it only leaves two. But only when there are three line breaks or more ..
Ex:
Hello everyone, how are you? Home | I really liked the site.
Should be:
Hello everyone, how are you? Home I really liked the site.