note 79095 deleted from function.preg-replace by felipe

From: Date: Mon, 10 Dec 2007 02:06:34 +0000
Subject: note 79095 deleted from function.preg-replace by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133087@lists.php.net to get a copy of this message
Note Submitter: chad dot d dot john son at g mail dot com ---- A little revision to Mac's email which replaces e-mail addresses with mailto hyperlinks. His version was not creating links out of email addresses surrounded by html tags (e.g. <b>joeschmoe@hotmail.com</b>). This new version could, however, create a problem if there are existing mailto links in the code. I obscure any existing mailto links first before running this. $text = preg_replace("/[\s|\,\>]([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*" . "\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})([\s|\.|\,\<])/i", " <a href=\"mailto:$1\">$1</a>$2", $text);

« previous php.notes (#133087) next »