let reg = /^(?:(http|https|ftp):\/\/)?((?:[\w-]+\.)+[a-z0-9]+)((?:\/[^/?#]*)+)?(\?[^#]+)?(#.+)?$/i
let str = 'http://www.hefeng6500.cn/home/index.html?hefeng6500=bob#test'

reg.exec(str)

网址url的正则表达式_JavaScript