K
Введите допустимый диапазон
Size: a a a
K
G
ЮК
G
EN
K
EN
ID
EN
ID
G
function getUrlParts (url) {
var magic = /^(https?):\/\/(ponyfoo\.com)(\/articles\/([a-z0-9-]+))$/
return magic.exec(url)
}
var parts = getUrlParts('http://ponyfoo.com/articles/es6-destructuring-in-depth')
var [,protocol,host,pathname,slug] = parts
console.log(protocol)
// <- 'http'
console.log(host)// <- 'ponyfoo.com'
console.log(pathname)// <- '/articles/es6-destructuring-in-depth'
console.log(slug)// <- 'es6-destructuring-in-depth'
EN
ID
EN
EN
EN
EN
G
EN
EN