frost Posted September 12, 2007 Share Posted September 12, 2007 $Text = preg_replace("/(http[s]?){1}:\/\/([:a-z_\-\\.\/0-9%~]+){1}(\?[a-z=0-9\-_&;]*)?(\#[a-z0-9]+)?/", " <a href=\"$1://$2$3$4\">$1://$2$3$4</a>", $Text); $Text = preg_replace('/\s(www\.)(\S+)/', ' <a href="http://\\1\\2" target="_blank">\\1\\2</a>', $Text); echo stripslashes($Text); I was able to slap together these 2 replacements for changing plain text links into active links. One finds all the text with http and the second finds the www text. I was wondering if there is a better way to do this? Cheers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.