1

I am working on a chat app in Ionicframework, i am sending and receiving the texts successfully via Sockets. There is one thing that is bugging me that:-

How can i find out if a message contains some external weblink e-g https://google.com etc...

I mean how other chat apps like Whatsapp filter out the external links in the messages.

I am not sure how to do that. I am thinking of following

Split out every word in the the message using space and then loop over every string to find out if starts with https:// or http://.

I am not sure if its the better way of doing it.

Please guide me how to do it or is there any NPM library that i may use?

Thanks in advance :)

Tahir
  • 54
  • 1
  • 7
  • regex(Regular_Expressions). https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions, learn some basic regex first and then built as per your requirements. – RootHacker Nov 21 '17 at 10:35

0 Answers0