note 48559 deleted from function.ereg-replace by kennyt

From: Date: Wed, 26 Jan 2005 03:53:50 +0000
Subject: note 48559 deleted from function.ereg-replace by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83979@lists.php.net to get a copy of this message
Note Submitter: [enEmy]Master.cz ---- This will add links (starting http, ftp, www, etc.) into a text, also replaces email with a link. <?php function AddLinks($text){ $text = ereg_replace("([[:alpha:]]+://)([^<>[:space:]]+[[:alnum:]/])","<a href=\"http://\\2\">\\0</a>", $text); $text = ereg_replace("www\.[[:alnum:]]*\.[[:alpha:]]*","<a href=\"http://\\0\">\\0</a>", $text); $text = ereg_replace("[[:alnum:]]*\@[[:alnum:]]*.[[:alnum:]]{2,4}","<a href=\"mailto:\\0\">\\0</a>", $text); return $text; } ?>

« previous php.notes (#83979) next »