note 20757 added to function.ereg-replace

From: Date: Mon, 15 Apr 2002 13:41:25 +0000
Subject: note 20757 added to function.ereg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-29362@lists.php.net to get a copy of this message
I realized that the second ereg_replace would not work, because it creates a link like "http:// www.php.ch" wich will not work. please use this one: $string = preg_replace("([ |\n]([a-zA-Z1-9\-_\.]+\.[a-zA-Z1-9\-_]+\.[a-z]{2,3}))", " <a href=\"http://\\1\" target=\"_blank\">\\1</a>", $string); It will search for a space but will not include it in the url, but displaying one in front of the link. if your url was after a new line, the space will be removed. -- http://www.php.net/manual/en/function.ereg-replace.php http://master.php.net/manage/user-notes.php?action=edit+20757 http://master.php.net/manage/user-notes.php?action=delete+20757 http://master.php.net/manage/user-notes.php?action=reject+20757

« previous php.notes (#29362) next »