Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


php parse links emails using -'php,regex'


php parse links emails  using -'php,regex'

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>
abc@def.com to  to <a href="mailto:mailto:abc@def.com">mailto:abc@def.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.
    

asked Sep 7, 2015 by rajesh
0 votes
7 views



Related Hot Questions



Government Jobs Opening


...