note 17409 rejected from function.preg-replace by philip
| From: | philip@php.net | Date: | Thu, 13 Dec 2001 05:47:35 +0000 |
| Subject: | note 17409 rejected from function.preg-replace by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22572@lists.php.net to get a copy of this message | ||
Hi @ll !
Here are the replacement functions of links and emails in a modified version.
They replace even links with subdirectories and seperators like - and _ as well.
The email function behaves the same way.
$text=preg_replace("/((http(s?):\/\/)|(www\.))([\w\.\-_\/]+)/i", "<a
href=\"http$3://$4$5\"
target=\"_blank\"><u>$2$4$5</u></a>", $text);
$text=preg_replace("/([\w\.\-_]+)(@)([\w\.\-_]+)/i", "<a href=\"mailto:$0\"><u>$0</u></a>", $text);
cya 2pHAzT
ps: visit www.code3000.de.vu