RE: [PHP] Re: url to link
| From: | Matthias Winkelmann | Date: | Sat, 28 Jul 2001 16:25:57 +0000 |
| Subject: | RE: [PHP] Re: url to link | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60060@lists.php.net to get a copy of this message | ||
This uses just one expression (and that is a fast preg_ insteat of ereg) for
both, mailto: and http: links (and news:, too):
$text =
preg_replace('#(^|[^\"=]{1})(http://|ftp://|mailto:|news:)([^\s<>]+)([\s\n<>
]|$)#sm',"\\1<a href=\\\"\\2\\3\\\"
target=\\\"blank\\\"><u>\\2\\3</u></a>\\4",$text);
ciao,
matt
--
s o m e o n GmbH
Community Software & Service
Elberfelder Str. 8 Tel. +49 (0)2104 171337
40822 Mettmann Fax +49 (0)2104 171 339
Germany
winkelmann@someon.com http://someon.com