Here is a design though: For example is I put a link such as
http://example.com
in textarea. How do I get PHP t
Here is something i found that is tried and tested
function make_links_blank($text)
{
return preg_replace(
array(
'/(?(?=]*>.+<\/a>)
(?:]*>.+<\/a>)
|
([^="\']?)((?:https?|ftp|bf2|):\/\/[^<> \n\r]+)
)/iex',
'/]*)target="?[^"\']+"?/i',
'/]+)>/i',
'/(^|\s)(www.[^<> \n\r]+)/iex',
'/(([_A-Za-z0-9-]+)(\\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-]+)
(\\.[A-Za-z0-9-]+)*)/iex'
),
array(
"stripslashes((strlen('\\2')>0?'\\1\\2\\3':'\\0'))",
'',
"stripslashes((strlen('\\2')>0?'\\1\\2\\3':'\\0'))",
"stripslashes((strlen('\\2')>0?'\\0':'\\0'))"
),
$text
);
}
It works for me. And it works for emails and URL's, Sorry to answer my own question. :(
But this one is the only that works
Here is the link where i found it : http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_21878567.html
Sry in advance for it being a experts-exchange.