let str = "https://www.baidu.com/s?wd=%E6%8E%98%E9%87%91&rsv_spt=1&E%2598%25E9%2587%2591&rsp=0";
let reg = /^(?:(http|https|ftp):\/\/)?((?:[\w-]+\.)+[a-z0-9]+)((?:\/[^/?#]*)+)?(\?[^#]+)?(#.+)?$/i;
console.log(reg.exec(str));
複製代碼
/^(?:(http|https|ftp):\/\/)?
((?:[\w-]+\.)+[a-z0-9]+)
((?:\/[^/?#]*)+)?
(\?[^#]+)?
(#.+)?$/i;
密碼包含大小寫字母加數字,長度6-16html
let reg = /(?!^[a-zA-Z]+$)(?!^[A-Z0-9]+$)(?!^[a-z0-9]+$)^[a-zA-Z0-9]{6,16}$/;
複製代碼