<?
$mem = "Hello world! http://www.helloworld.com\n

Hello world! ftp://ftp.server.com\n

Hello world www.helloworld.com";

// code starts here

$mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' <A href=\"'.

(ereg('^[http:|ftp:]','\\1')

? '\\1\">\\1</A>'

: 'http://\\1\";>http://\\1</A>')", $mem);

print ($mem);

?>

good luck,

"Jesse Lawrence" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

> Hello there, I'm putting together a message board, and
> would like to automatically turn any instance of
> http://whatever into a link, without requiring the
> viewers to enter html.  I'm thinking regex is probably
> the way to go with this, but I'm not really seeing how
> to do it.  If someone could point me towards a
> solution, it would be greatly appreciated.
>
> Thanks very much,
> Jesse Lawrence
> http://soniceast.d2g.ca/jesse/
>
> ______________________________________________________________________
> Post your ad for free now! http://personals.yahoo.ca



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to