使用正则表达式解析http请求url中的参数和参数值
生活随笔
收集整理的這篇文章主要介紹了
使用正则表达式解析http请求url中的参数和参数值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<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中的参数和参数值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 五一假期不怕排队!百度地图上线排队雷达:
- 下一篇: SAP Cloud for Custom