note 29166 deleted from function.preg-replace by sniper

From: Date: Sun, 07 Sep 2003 22:03:28 +0000
Subject: note 29166 deleted from function.preg-replace by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55690@lists.php.net to get a copy of this message
Note Submitter: jomango@jomangodotcom ---- As a rendition to the link replacement scripts from above... for the regular link replacement, if there was a dash in the link, it would nt function properly. $text = preg_replace( "/\b((http(s?):\/\/)|(www\.))([\w\.-]+)([\/\w+\.]+)\b/i", "<a href=\"http$3://$4$5$6\">$4$5$6</a>", $text); ... the above code is a fix to that. $text = preg_replace("/\b([\w\.]+)(@)([\w\.-]+)\b/i", "<a href=\"mailto:$0\">$0</a>", $text); ... that is the fix for the email replacemnt. Hope that helps someone...

« previous php.notes (#55690) next »