Created
June 24, 2013 10:47
-
-
Save elieandraos/5849246 to your computer and use it in GitHub Desktop.
Convert Plain to text links to HTML Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RegEx = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; | |
$("#p").filter(function() { | |
return $(this).html().match(RegEx); | |
}).each(function() { | |
$(this).html($(this).html().replace(RegEx, "<a href=\"$1\">$1</a>")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment