JS常用正则表达式(手写系列) 陈进步 2022-03-11 226 阅读1分钟 解析url参数 // 不受hash值干扰 function getParamUrl(url){ let result = {} let reg = /([^?=&#]+)=([^?=&#]+)/g url.replace(reg,(n,x,y)=>{result[x]=y) return result }