Re: How to convert URL's to Links in User posted text in forms ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I found this on searching for "links in submitted text"
its in Ruby.... gotta convert to php and try
there are many regex samples in the php manual itself
but maybe incomplete

in = "go check out www.xyz.com or http://xyz.com";
in.gsub!(/([^/])(www.([w/_.~])*)/, '\1<a href="http://\2";
target="_blank">\2</a>')
in.gsub!(/([^"])(https?://([-w.]+)+(:d+)?(/([w/_.]*(?S+)?)?)?)/,
    '\1<a href="\2" target="_blank">\2</a>')

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux