note 20757 deleted from function.ereg-replace by sander
| From: | sander@php.net | Date: | Tue, 16 Apr 2002 14:14:48 +0000 |
| Subject: | note 20757 deleted from function.ereg-replace by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-29431@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.