PHP-将文本URL更改为字符串形式的真实URL

PHP-将文本URL更改为字符串形式的真实URL,php,regex,Php,Regex,我有条件: $string1 = 'Hi John. Please, go to my website http://www.google.com :)'; $string2 = 'See this :P www.imgurl.com/abcd.jpg'; 如何将此字符串转换为: $string1 = 'Hi John. Please, go to my website <a href="http://www.google.com">http://www.google.com<

我有条件:

$string1 = 'Hi John. Please, go to my website http://www.google.com :)';
$string2 = 'See this :P www.imgurl.com/abcd.jpg';
如何将此字符串转换为:

$string1 = 'Hi John. Please, go to my website <a href="http://www.google.com">http://www.google.com</a> :)';
$string2 = 'See this :P <img src="http://www.imgurl.com/abcd.jpg" alt ="" />';
$string1='你好,约翰。请访问我的网站:);
$string2='见此:P';

我不知道;(

最好的方法是使用正则表达式将URL替换为

下面是匹配URL的正则表达式列表: