Depends on how serious you want to get:
Only identifies http and ftp urls; not telnet, mailto, nntp nor any of
the others out there.
$xalpha='([a-zA-Z\d$@.&+!*"\'(),-]|%[\da-fA-F]{2})';
$ialpha="[a-zA-Z]$xalpha+";
$alphanum2='[a-zA-Z\d.+-]';
$search="$xalpha+(+$xalpha+)";
$path="($xalpha+(/$xalpha+))?"
$hostnumber="\d{1,3}(.\d{1,3}){3}";
$hostname="$ialpha(.$ialpha)*";
$host="($hostname|$hostnumber)";
$hostport="$host(:\d+)?";
$user=$password="$alphanum2+";
$ftptype="([AE][NTC]|I|L\d+)";
$login="($user(:$password)?@)?$hostport";
$ftpaddress="ftp://$login/$path(;$ftptype)?";
$httpaddress="http://$hostport($path)?(\?$search)?";
$url="$httpaddress|$ftpaddress";
regexp = "#$url#";
preg_match_all($regexp,$page,$matches);