export function getUrlPrefix () {
let href = location.href
var reg = new RegExp(/(\w+):\/\/([^/:]+)(:\d*)?/)
let matchObj = href.match(reg)
if (matchObj) {
return matchObj[0]
} else {
return null
}
}
export function getUrlPrefix () {
let href = location.href
var reg = new RegExp(/(\w+):\/\/([^/:]+)(:\d*)?/)
let matchObj = href.match(reg)
if (matchObj) {
return matchObj[0]
} else {
return null
}
}
本文标题:js正则表达式获取协议、域名、端口号
本文链接:https://www.haomeiwen.com/subject/psodpftx.html
网友评论