var reg = /.*\&b\=([^\&]*)\&?.*/;var url = "b.html?a=qew12321&b=wqeqw321&c=212";url = url.replace(reg, "$1");console.error(url);