第一种: 

获取网站的 hostname

 

 

 

第二种: 正则匹配

let a = 'https://cnblogs.com/posts/edit'
let b = /^http(s)?:\/\/(.*?)\//
console.log(b.exec(a)[2])
// cnblogs.com

 

获取网站的 hostname

 

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2021-12-10
  • 2021-08-17
  • 2021-07-06
猜你喜欢
  • 2021-08-24
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-12-25
相关资源
相似解决方案