Okay... this time an even better solution, without the /e modifier.
Think this comes pretty close to some final solution.
--- PHP code ---
<PRE>
<?php
$mem = "Hello world! http://www.helloworld.com\n
Hello world! ftp://ftp.server.com\n
Hello world www.helloworld.com";
/* ------ ! Fifth regexp ! ------ */
$pattern = array ("~\s+((?:http://|ftp://){0}(?:\w+\.)+(?:\w+))~m",
"~\s+((?:http://|ftp://)+(?:\w+\.)+(?:\w+))~m");
$replace = array (" <A href=\"http://$1\">http://$1</A>",
" <A href=\"$1\">$1</A>");
$mem = preg_replace ($pattern, $replace, $mem);
print ($mem);
?>
</PRE>
--- End of PHP code ---
This still needs some optimization imo (...)
--
* 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]