我有这个字符串:
var value = recordsArray_f006b490[]=1&recordsArray_9715b841[]=1&recordsArray_afb085e2[]=1&recordsArray_fc542e23[]=1&recordsArray_19490084[]=1&recordsArray_615a5055[]=1&recordsArray_32841aa6[]=1&recordsArray_a02a35c7[]=1&recordsArray_d32b5b88[]=1&recordsArray_d32d5339[]=1&recordsArray_56c2b8e10[]=1&recordsArray_8ce9f4211[]=1&recordsArray_5a87afc12[]=1&recordsArray_2b13c0113[]=1&recordsArray_afb085e14[]=1&recordsArray_51db9f216[]=1&recordsArray_2a7470415[]=1&recordsArray_d51057a17[]=1&recordsArray_b274ee918[]=1&recordsArray_d0812dd19[]=1&recordsArray_b1ede8920[]=1&recordsArray_9d76ae821[]=1&recordsArray_0ae779d22[]=1&recordsArray_871777923[]=1&recordsArray_9e22c9f24[]=220236&recordsArray_787c57e25[]=220236&recordsArray_499e25726[]=1&recordsArray_a0600da27[]=220236&recordsArray_9ef1fca28[]=220236&recordsArray_67eee1929[]=220236&recordsArray_24c3a0b30[]=220236&recordsArray_5d2090831[]=220236
我想用“_”替换“[]=”,我有下一个javascript代码:
var regex = new RegExp("[]=", "g");
alert(value.replace(regex, "_"));
但它并没有改变任何东西,我该怎么做?谢谢!