<html>
<script>
var test = "#token=Be&access_token=fff&$id_token=ets&expires_in=3600&scope=full";
var anotherTry = function(value) {
var reg = /(?:^\#|&)(.*?)=(.*?)(?=&|$)/g; // 字符串结尾
var temp;
while((temp = reg.exec(value))!= null) {
console.log("Key: " + temp[1] + " value: " + temp[2]);
}
};
anotherTry(test);
debugger;
</script>
</html>
使用正则表达式解析http请求url中的参数和参数值
猜你喜欢
转载自blog.csdn.net/i042416/article/details/104950933
今日推荐
周排行