note 17384 added to function.preg-replace

From: Date: Thu, 06 Dec 2001 14:07:06 +0000
Subject: note 17384 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-21711@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); } -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+17384 http://master.php.net/manage/user-notes.php?action=delete+17384 http://master.php.net/manage/user-notes.php?action=reject+17384

« previous php.notes (#21711) next »