Replace URL

Posted on Monday, August 10, 2009 in PHP

$pattern='|http://(\S+)|is';
$msg=preg_replace($pattern, '< a href="http://$1" target="_blank">http://$1< /a >', $msg);

Leave a Comment

You must be logged in to post a comment.