// 验证url let urlRegex = /^https?:\/\/\w+\.(\w+\.)+[a-z]$/ // 返回true和false console.log(urlRegex.test("http://baidu.com")); 验证正则