url正则匹配

let reg = /^(?:(http|https|ftp):\/\/)?((?:[\w-]+\.)+[a-z0-9]+)((?:\/[^/?#]*)+)?(\?[^#]+)?(#.+)?$/i;
let str = 'https://www.zhufeng.cm';
console.log(reg.exec(str))

posted @ 2020-04-24 16:40  Ck刺客  阅读(1339)  评论(0编辑  收藏  举报