I am wondering if there is a simple snippet which converts links of any kind:
http://www.cnn.com to <a href="http://www.cnn.com">http://www.cnn.com</a> cnn.com to <a href="http://www.cnn.com">cnn.com</a> www.cnn.com to <a href="http://www.cnn.com">www.cnn.com</a> email@example.com to to <a href="mailto:mailto:firstname.lastname@example.org">mailto:email@example.com</a>
I do not want to use any PHP5 specific library.
Thank you for your time.
UPDATE I have updated the above text to what i want to convert it to. Please note that the href tag and the text are different for case 2 and 3.
UPDATE2 Hows does gmail chat do it? Theirs is pretty smart and works only for real domains names. e.g. a.ly works but a.cb does not work.