URL replace with link (includes period and space)
<?php
$s = 'Please visit http://google.com. Then return to our site.';
$r = preg_replace('"<a[^>]+>.+?</a>(*SKIP)(*FAIL)|\b(?:https?)://\S+"', '<a href="$0">$0</a>', $s);
echo $r;INFO
<?php
$s = 'Please visit http://google.com. Then return to our site.';
$r = preg_replace('"<a[^>]+>.+?</a>(*SKIP)(*FAIL)|\b(?:https?)://\S+"', '<a href="$0">$0</a>', $s);
echo $r;