I found this on searching for "links in submitted text" its in Ruby.... gotta convert to php and try there are many regex samples in the php manual itself but maybe incomplete
in = "go check out www.xyz.com or http://xyz.com" in.gsub!(/([^/])(www.([w/_.~])*)/, '\1<a href="http://\2" target="_blank">\2</a>') in.gsub!(/([^"])(https?://([-w.]+)+(:d+)?(/([w/_.]*(?S+)?)?)?)/, '\1<a href="\2" target="_blank">\2</a>') -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php