Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
38
rated 0 times [  43] [ 5]  / answers: 1 / hits: 91844  / 12 Years ago, mon, february 4, 2013, 12:00:00

Possible Duplicate:

How can I get query string values?






Trying to get a 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?



enter


More From » regex

 Answers
11

How about this pattern:



(?|&)([^=]+)=([^&]+)

[#80444] Friday, February 1, 2013, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brandensebastiand

Total Points: 323
Total Questions: 115
Total Answers: 106

Location: China
Member since Mon, Aug 22, 2022
2 Years ago
;