Possible Duplicate:
How can I get query string values?可能重复:如何获得查询字符串值?
Trying to get a regex (Javascript).
尝试获取一个regex (Javascript)。
Input: url.html?id=14114&yolo=hahaha
Output: id=14114
yolo=hahaha
So this is what i have done so far: (\&|\?)(.*?)\=(.*?)
这就是到目前为止我所做的:(\ & | \ ?)(. * ?)\ =(. * ?)
How do I also include the red circled regions?
如何包含红色圆圈区域?
2 个解决方案
#1
24
How about this pattern:
这个模式:
(\?|\&)([^=]+)\=([^&]+)
#1
24
How about this pattern:
这个模式:
(\?|\&)([^=]+)\=([^&]+)