正则表达式提取url中的ip地址
let url = 'http://127.0.0.1:3000'
let reg_str = /\d+\.\d+\.\d+\.\d+/
console.log(url.match(reg_str)) // ["127.0.0.1", index: 7, input: "http://127.0.0.1:3000"]
// 获取url
let url = 'http://127.0.0.1:3000?name=张三'
let reg_str = /^http:\/\/\d+\.\d+\.\d+\.\d+:\d+/
let data = url.match(reg_str)
console.log(data)