note 24517 added to function.preg-replace
| From: | sylvinus at lynucs dot com | Date: | Tue, 20 Aug 2002 09:17:32 +0000 |
| Subject: | note 24517 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35239@lists.php.net to get a copy of this message | ||
Here's an improved url detection preg :
$text = preg_replace("/(?:^|\b)((((http|https|ftp):\/\/)|(www\.))
([\w\.]+)([,:%#&\/?=\w+\.-]+))(?:\b|$)/is", "<a href=\"$1\"
target=\"_blank\">$1</a>", $text);
Hope it'll help :-)
Sylvinus
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+24517
http://master.php.net/manage/user-notes.php?action=delete+24517
http://master.php.net/manage/user-notes.php?action=reject+24517