I know this issue has been discussed numerous times, but I think this is the solution best for me:
Given a string of text, if there is a an occurance of “www.blah.com”, then wrap it with <a href="http://www.blah.com">
How can I do that in Javascript?
Also, if there is an occurance of “http://www.blah.com”, do the same thing (but do not add an extra “http://”)
I recommend you take a look at open-source solutions such as Linkify:
Here is sample how to do it: