note 35563 rejected from function.preg-replace by sniper

From: Date: Sun, 07 Sep 2003 21:55:50 +0000
Subject: note 35563 rejected from function.preg-replace by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55667@lists.php.net to get a copy of this message
Note Submitter: ---- the code in the previous post is incorrect, it should be: $text = preg_replace("/(?:^|\b)((((http|https|ftp):\/\/)) ([\w\.]+)([,:%#&\/?~=\w+\.-]+))(?:\b|$)/is","<a href=\"$1\" target=\"_blank\">$1</a>",$text); $text = preg_replace("/(?<!http:\/\/)(?:^|\b)(((www\.)) ([\w\.]+)([,:%#&\/?~=\w+\.-]+))(?:\b|$)/is", "<a href=\"http://$1\" target=\"_blank\">$1</a>", $text); $text = preg_replace("/(([\w\.]+))(@)([\w\.]+)\b/i", "<a href=\"mailto:$0\">$0</a>", $text); the links the other code would create for url's like "www.spacevs.com" would be: <a href="www.spacevs.com">www.spacevs.com</a> where it should be: <a href="http://www.spacevs.com">www.spacevs.com</a>

« previous php.notes (#55667) next »