note 13668 added to function.preg-replace.php
| From: | sluderitz at yahoo dot de | Date: | Thu, 28 Jun 2001 09:30:38 +0000 |
| Subject: | note 13668 added to function.preg-replace.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14710@lists.php.net to get a copy of this message | ||
I use this function to make hyperlinks from user submitted URL's (useful for notice boards,
etc.):
$message = preg_replace("/((http(s?):\/\/)|(www\.))([\w\.]+)/i", "<a
href=\"http$3://$4$5\" target=\"_blank\">$2$4$5</a>", $message);
http://www.php.net/manual/en/function.preg-replace.php