Retrieving all URL parameters with regex

Possible duplicate:
How to get query string values?

Trying to get regular expression (Javascript).

Input: url.html?id=14114&yolo=hahaha Output: id=14114 yolo=hahaha 

So here is what I have done so far: (\&|\?)(.*?)\=(.*?)

How to enable red circled areas?

enter image description here

+8
javascript regex
source share
2 answers

How about this template:

 (\?|\&)([^=]+)\=([^&]+) 
+21
source share
 [^&?]*?=[^&?]* 

checked here

http://fiddle.re/bmdu

+11
source share

All Articles