I have this part of the code for my txt to url convert
$message=preg_replace("/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))/", "<a href=\"$1\">$1</a>", $message);
The above code is in my PHP file for converting $message(from a form submitted by a user) to URL in html.
When a user gives http://www.google.com the output is http://www.MYDOMAIN.com/www.google.com.
I cant figure out where in "<a href=\"$1\">$1</a>" is my problem.
Any help?
some thing like this