note 29074 added to function.ereg-replace
| From: | Alex at rack1 dot php dot net | Date: | Sat, 01 Feb 2003 01:07:28 +0000 |
| Subject: | note 29074 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43237@lists.php.net to get a copy of this message | ||
Last message was not correct
Replace URLs with links
http://www.somepage.zzz?x=afvdfg&y=dfgsdfgsdfg...
http://www.somepage.zzz
http://php.net
ftp://ftp.php.net
www.php.net
This is correct:
$mes=ereg_replace("(([^\.<>[:space:]]+\.)|([[:alpha:]]+://))+".
"[^\.<>[:space:]]+\.[^<>[:space:]]+", "<a href=\"http://\\0\" target=\"_blank\">\\0</a>",
$mes);
$mes=ereg_replace("http://([[:alpha:]]+://)","\\1",$mes);
--
http://www.php.net/manual/en/function.ereg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+29074
http://master.php.net/manage/user-notes.php?action=delete+29074
http://master.php.net/manage/user-notes.php?action=reject+29074