var processText = function (text) {
var txt = (text || '').replace(/(http(s)?:\/\/[^\s]+)/gi, '<a class="link" href="$1" target="_blank">$1</a>').replace(/\r\n/g, '<br />').replace(/\n/g, '<br />');
return txt;
};
### Usage
processText(document.body)
Last active
December 27, 2016 00:15
-
-
Save ali-master/6c979115707d8ef41e8d509d208f3411 to your computer and use it in GitHub Desktop.
Process Text for find and create an anchor link for each of texts link
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment