tags:

views:

31

answers:

1

i did one chat application ,

in the my chat pings area am displaying my pings, if i enter url that is displaying as TEXT but instead i want to display as URL ,

How to display url are Link the view,

Advise...

Example ,

x says:hi Good Morning,
y says:Hi GM,
x says:Chk this www.happylife.in ,(instead text i want to show www.happylife.in  URL or LINK)
y says:yes sure
+4  A: 
$chat = "Chk this http://www.happylife.in";
$chat = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<a target=\"_blank\" href=\"$1\">$1</A>", $chat);
NAVEED
but some time user may enter something like this yahoo.com OR www.yahoo.com OR http://yahoo.com OR http://www.yahoo.com For this situation but in some situation they might user bharani. ..then this text consider as link know !
Bharanikumar
Yes you are right but '.' is also used in simple English. Therefore it will be difficult to recognize that it is simple text or a url. it will convert text into url that starts with "http://".
NAVEED