Re: How to convert URL's to Links in User posted text in forms ?

From: Date: Sat, 13 Oct 2007 23:36:44 +0000
Subject: Re: How to convert URL's to Links in User posted text in forms ?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-263191@lists.php.net to get a copy of this message
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>')

« previous php.general (#263191) next »