I want to capture every name=value
pair with regex in a url query.
Lets say I have queries like this:
?lm=1403085628
?lm=1403085628&other=343323
?lm=1403085628&other=&second=34342
?lm=1403085628&=343243&second=34342
?lm=1403085628&other=343323&some=efsfs
?
?lm=1403085628&other=343323&&&wrong
If I try this: ^\?(?:([a-zA-Z0-9-_]+\=[a-zA-Z0-9-_]+)&?)*
This capture the last occurrence only, for example some=efsfs
for the third one.
But what I want is an array of key value pairs like this:
[
'lm=1403085628',
'other=',
'second=34342'
]
How can I capture all occurrences of a capture group?
PS: I think this must have bee asked before but I cannot find any question, but maybe because I don't know the wording.