note 17384 deleted from function.preg-replace by jimw

From: Date: Thu, 20 Dec 2001 21:29:31 +0000
Subject: note 17384 deleted from function.preg-replace by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23453@lists.php.net to get a copy of this message
Heres another version on replacing urls with links... the good part is this one doesent mess up those with other tags... what i mean is, that if a user submits html in a form into a script alongside with the url this version doesent mess up the tags... it leaves <img src="http://someserver.com/images/image.jpg"> alone function insert_links($tmpstr) { return preg_replace('/[\s](http:\/\/[^\s]+)/','<A href="\\0">\\0</A>',$tmpstr); }

« previous php.notes (#23453) next »