Apr 5, 2011
Posted in "development"
var exp = /(b(https?|ftp|file)://[-A-Z0-9+&amp;@#/%?=~_|!:,.;]*[-A-Z0-9+&amp;@#/%=~_|])/ig; $('body').html($('body').html().replace(exp,"&lt;a href='$1'&gt;$1&lt;/a&gt;"));
It should be noted that you won't want to use the
.replace() on your entire document or body element if you've got pre-existing active links. If you do, it may cause a conflict and duplicate the HTML link syntax. With that said, be specific with your selectors that will be used to find and replace static urls.