showing results for - "get url from string javascript"
Barack
27 Jan 2018
1function Purify(text) {
2    var urlRegex = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
3    return text.replace(urlRegex, function (url) {
4        return '<a class="text-blurple" target="_blank" href="' + url + '">' + url + '</a>';
5    })
6}
Paul
08 Jul 2016
1var testUrl = variable.match(/'(http:[^\s]+)'/)