Re: function that makes http into <ahref
| From: | (Dave Daniels) | Date: | Tue, 08 Aug 2000 17:07:24 +0000 |
| Subject: | Re: function that makes http into <ahref | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10739@lists.php.net to get a copy of this message | ||
I do it a little different than the other suggestions -- I call the
following Perl script using backticks. It catches a few more things...
#!/usr/bin/perl
use URI::Heuristic;
use URI::Find;
$string = shift;
$string =~ /(\w+@\w+\.(com|org|net|edu|mil))/;
$original = $1;
find_uris($string,
sub {
my($uri, $orig_uri) = @_;
return qq|<a href="$uri">$orig_uri</a>|;
});
if ($original) {
$link = URI::Heuristic::uf_uristr($original);
$string =~ s/$original/<a href=\"$link\">$original<\/a>/;
};
print $string;
exit;
----- Original Message -----
From: "Peter Van Dijck" <peter@vardus.com>
To: <php-general@lists.php.net>
Sent: Tuesday, August 08, 2000 3:47 AM
Subject: [PHP] function that makes http into <ahref
> Anyone got a function that parses a text string and turns everything that
> looks like a url into a clickable url?
>
> thanks girls and guys,
> Peter
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>