note 86028 deleted from function.ereg-replace by danbrown

From: Date: Tue, 30 Sep 2008 14:11:44 +0000
Subject: note 86028 deleted from function.ereg-replace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-144903@lists.php.net to get a copy of this message
Note Submitter: info at webmedia-center dot com Reason: non-english ---- donc Voilà, fonction hyperlink qui fonctionne (avec les emails en plus) hyperlink($text) { $text = ereg_replace("[a-zA-Z]+://([-]*[.]?[a-zA-Z0-9_/-?&%])*", "<a href=\"\\0\">\\0</a>", $text); $text = ereg_replace("(^| |.)(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a href=\"http://\\2\">\\2</a>", $text); $text = ereg_replace("[a-zA-Z0-9_-|\.]+@[a-zA-Z0-9_-]+.[[:alpha:]]{2,5}", "<a href=\"mailto:\\0\">\\0</a>", $text); return $text; }

« previous php.notes (#144903) next »