正则表达式解析查询字符串 发表于 2017-11-02 | 分类于 前端开发 123456789101112131415161718function parseQueryString(f) { const d = /(([^?&=]+)(?:=([^?&=]*))*)/g; const a = {}; let b; let c; let e; while (b = d.exec(f)) { c = b[2]; e = b[3] || ''; a[c] = decodeURIComponent(e); } return a;}parseQueryString(window.location.search);