var content = 'http://home.com/goods/detail.html?id=845';
var rep1 = getRegExp('\?id=(.*)','i');
var rep2 = getRegExp('id=(.*)','i');
var rep3 = getRegExp('id=(.*)','i');
var code1 = content.match(rep1)[1];//取 ?id=后面所有字符串
var code2 = content.match(rep2)[1];//取 id=后面所有字符串
var code3 = content.match(rep3)[0]; //取 包含 id=及后面的字符串
console.log('?id= 后的内容为: '+code1);
console.log('id= 后的内容为: '+code2);
console.log('包含 id= 的所有内容为: '+code3);
var content = 'http://home.com/goods/detail.html?id=845';
var code1 = content.match(/\?id=(.*)/)[1];//取 ?id=后面所有字符串
var code2 = content.match(/id=(.*)/)[1];//取 id=后面所有字符串
var code3 = content.match(/id=(.*)/)[0]; //取 包含 id=及后面的字符串
console.log('?id= 后的内容为: '+code1);
console.log('id= 后的内容为: '+code2);
console.log('包含 id= 的所有内容为: '+code3);