Got another solution. So far the first solution not using the /e
modifier. It's not realy the best solution, but I'm still trying to
improve it. Getting closer every time...

--- PHP code ---
<PRE>
<?php

$mem = "Hello world! http://www.helloworld.com\n
Hello world! ftp://ftp.server.com\n
Hello world www.helloworld.com";

/* ------ ! Fourth regexp ! ------ */
$mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/m",
        " <A href=\"http://\\1\\3\";>http://\\1\\3</A>",
        $mem);
$mem = preg_replace ("/http:\/\/([http:\/\/|ftp:\/\/]+)/m",
        "\\1", $mem);

print ($mem);

?>
</PRE>
--- End of PHP code ---

-- 

* R&zE:


-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to