Use Replace to convert the address bar:
varUrl= ' https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=js%E6%AD%A3%E5%88 %99%e8%a1%a8%e8%be%be%e5%bc%8f&oq=js%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%20kongge&rsv_pq= E63baa94000c303c&rsv_t=2200eomme0fgnsjlppijbdy2ww1cakuxvt8jce2bif1gxlj%2btzixfz%2batle&rsv_enter=1 &inputt=294&rsv_sug3=56&rsv_sug1=15&rsv_sug7=100&rsv_sug2=0&rsv_sug4=772&rsv_sug=2 ‘;//parsing the simulated address bar//var url = location.search.substr (1); This is the case of intercepting the address bar, "? "Question mark after the contentvarparam ={};url.replace (/([^?&]+) = ([^?&]+)/g,function(S, V, K) {Console.log (' This is the chosen a=b: ' +s+ ', \ n This is the key: ' +v+ ', \ n This is the value: ' +k+ '. ‘); PARAM[V]= decodeURIComponent (k);//parse character to Chinese returnK + ' = ' +v;}); Console.log (param);/*The output is: *f: "8" *ie: "Utf-8" *inputt: "294" *oq: "JS regular expression Kongge" *RSV_BP: "1" *rsv_enter: "1" *RSV_IDX: "1" *RSV_PQ: " e63baa94000c303c "*rsv_sug:" 2 "*RSV_SUG1:" The "*RSV_SUG2:" 0 "*rsv_sug3:" "" *rsv_sug4 "772:" [] ":" *rsv_sug7 ":" 2200eomme0fgnsjlppijbdy2ww1cakuxvt8jce2bif1gxlj+tzixfz+atle "*TN:" Baidu "*WD:" JS Regular expression "*/
JS Regular Expressions convert URLs to JSON format