RE: [PHP] http://
| From: | Martin Towell | Date: | Fri, 08 Feb 2002 03:10:46 +0000 |
| Subject: | RE: [PHP] http:// | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-83958@lists.php.net to get a copy of this message | ||
try this:
$str = $s24; // this is the string you want to look at...
$dst = '<a href="\\1">\\1</a>\\2';
foreach (array("http://", "mailto:", "telnet:", "news:") as $src)
{
$str = ereg_replace("(".$src."[^ ]*)( *)", $dst, $str);
}
echo $str;
-----Original Message-----
From: jtjohnston [mailto:taylorjo@collegesherbrooke.qc.ca]
Sent: Friday, February 08, 2002 2:03 PM
To: php-general@lists.php.net
Subject: [PHP] http://
I'm looking for a function that will find occurences of urls in any
given string and do this:
http://www.nowhere.com/
becomes
<a href="http://www.nowhere.com/">http://www.nowhere.com/</a>
Could, should also look for
mailto:someone@nowhere.com
telnet:blah.blah
or even news:blaj.blah
Does such a thing exist?
--
John Taylor-Johnston
----------------------------------------------------------------------------
-
Collège de Sherbrooke:
http://www.collegesherbrooke.qc.ca/languesmodernes/
Université de Sherbrooke:
http://compcanlit.ca/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php