Re: Re: url to link
| From: | bill | Date: | Mon, 30 Jul 2001 14:18:40 +0000 |
| Subject: | Re: Re: url to link | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60219@lists.php.net to get a copy of this message | ||
Hi Matthias,
I tried it but it didn't work. It returned a "Document contains no data" error.
I put the preg_replace info all on one line. Could that have affected any
whitespace?
kind regards,
bill
Matthias Winkelmann wrote:
> 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