I'm trying to match these kind of character sequences:
sender=11&receiver=2&subject=3&message=4
sender=AOFJOIA&receiver=p2308u48302rf0&subject=(@#UROJ)(J#OFN:&message=aoefhoa348!!!
Where the delimiters between (key, val) pair is the '&' character. I'd like to group them in a way I can get access to the key and the value of each pair.
I tried something like:
([[:alnum:]]+)=([[:alnum:]]+)
But then I miss the:
subject=(@#UROJ)(J#OFN:
I couldn't find a way to allow these type of characters to be accepted.
To be more specific, if there are n
pairs of key-value, I would like to have n
matches, each consisting of 2 groups - 1 for the key, 1 for the value.
I'd be glad if you helped me out with this.
Thanks