I’m doing a simple chat. When user sends message to server I want to parse this message. Whenever I find http://**** I want to convert it into a a tag, but all other characters need to be escaped, so that a user won’t mess with html.
There are probably many ways to obtain it. Using some fancy regular expressions would be nice. Any ideas?
Note that I’m using Node.js.
How about running each line of chat through this function before it is output to the user:
Source: How to replace plain URLs with links?