hakanersu
3/21/2014 - 11:59 AM

Create link from text

Create link from text

function createLink(text) {
	    var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i;
	    text = text.replace(exp, "<a href='$1' target='_blank'>$1</a>");
	    return text;
	}