php parse links emails ¬†using -'php,regex'
I am wondering if there is a simple snippet which converts links of any kind:
to <a href="http://www.cnn.com
cnn.com to <a href="http://www.cnn.com
www.cnn.com to <a href="http://www.cnn.com
firstname.lastname@example.org to ¬†to <a href="mailto:mailto:email@example.com">mailto:firstname.lastname@example.org</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.