I have developped a chat application on my phone. I noticed that when my messages are links, they are not recognized.
So I used regex to solve the issue and met an other problem.
Here is the string I’m sending :
var input = document.getElementById("myMessage").value; var mm = input.replace(/((?:https?://|www)[^s]+)/g,"<a href='$1'>$1</a>");
The received string is like this :
For instance, if I send : www.google.com, the guy at the other side of the chat receives :
while I’m expecting
I don’t understand why am I getting this. Should the reveiving string be formatted like the opposite of the sending string ? meaning
I don’t know regex at all so I may tell crap.