I am trying to detect links inside a textarea and display it in my view.
So I tried these preg_replace instructions
preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<a target=\"_blank\" href=\"$1\">$1</A>",$detail);
preg_replace('@(http)?(s)?(://)?(([a-zA-Z])([-\w]+\.)+([^\s\.]+[^\s]*)+[^,.\s])@', '<a target="ref" href="http$2://$4">$1$2$3$4</a>', $detail);
and it's done great on the whole except when I got URL containing special character like follow :
http://website.info/x-y-z-a/~~~~dcvvvc|cvvcvc~~~/cvcvcv-5-1.html.
Then it's not working at all.
Thanks