You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
413 B
15 lines
413 B
var unique = require('./unique'); |
|
var trim = require('./trim'); |
|
var map = require('./map'); |
|
var toArr = require('./toArr'); |
|
exports = function(str) { |
|
var urlList = toArr(str.match(regUrl)); |
|
return unique( |
|
map(urlList, function(url) { |
|
return trim(url); |
|
}) |
|
); |
|
}; |
|
var regUrl = /((https?)|(ftp)):\/\/[\w.]+[^ \f\n\r\t\v"\\<>[\]\u2100-\uFFFF(),]*/gi; |
|
|
|
module.exports = exports;
|
|
|