note 75739 added to function.preg-match

From: Date: Wed, 13 Jun 2007 21:07:57 +0000
Subject: note 75739 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-127460@lists.php.net to get a copy of this message
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... ---- Server IP: 212.124.37.9 Probable Submitter: 84.130.255.175 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/75739 Del: integrated -- https://master.php.net/note/delete/75739/integrated Del: useless -- https://master.php.net/note/delete/75739/useless Del: bad code -- https://master.php.net/note/delete/75739/bad+code Del: spam -- https://master.php.net/note/delete/75739/spam Del: non-english -- https://master.php.net/note/delete/75739/non-english Del: in docs -- https://master.php.net/note/delete/75739/in+docs Del: other reasons-- https://master.php.net/note/delete/75739 Reject -- https://master.php.net/note/reject/75739 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127460) next »