note 75739 deleted from function.preg-match by colder

From: Date: Mon, 18 Jun 2007 18:12:28 +0000
Subject: note 75739 deleted from function.preg-match by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127572@lists.php.net to get a copy of this message
Note Submitter: Marcel Jnemann ---- You want to replace all emails in a text by a link? And you have your own PHP-Spam-Protection? See my solution: function EmailsToLinks ( $text ) { $reg = '"([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})"i'; $found = array (); if ( preg_match ( $reg, $text, $found ) ) return str_replace ( $found [0], MySpamProtection ( $found [0] ), $text ); else return $text; } For example, MySpamProtection replaces an email by a html/javascript source code...

« previous php.notes (#127572) next »