Troy May wrote:
How would take a regular non-formatted text link (http://www.link.com) and
turn it into ready to post HTML? (<a
href=http://www.link.com>http://www.link.com</a>)

Darn, Outlook formats it, but you get the idea.  It would just be typed out
normally.

Any ideas?


function MakeUrl ($text) {
$text = preg_replace("/(www\.[a-zA-Z0-9\.\/#~:?+=&%@!_\\-]+)/", "http://\\1"; ,$text);#make www. -> http://www.
$text = preg_replace("/(http:\/\/)(?!www)([a-zA-Z0-9\.\/#~:?+=&%@!_\\-]+)/", "\\1\\2" ,$text); #eg-- http://kernel.org
$text = preg_replace("/(http:\/\/)(www\.)([a-zA-Z0-9\.\/#~:?+=&%@!\\-_]+)/", "\\1\\2\\3" ,$text); #eg -- http://www.google.com -> <a href"http://www.google.com";>www.google.com</a>
return $text;
}


--

Sean


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to