note 17409 added to function.preg-replace

From: Date: Fri, 07 Dec 2001 11:35:40 +0000
Subject: note 17409 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-21854@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 -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+17409 http://master.php.net/manage/user-notes.php?action=delete+17409 http://master.php.net/manage/user-notes.php?action=reject+17409

« previous php.notes (#21854) next »