What is the regex to parse a String
into a java.util.Map
where the String have a defined format like this:
message_type={any_text}&message_number={digits}&code={digits}&id={digits}&message={any_text}×tamp={digits_with_decimal}
The goal is to generate a Map with message_type, message_number, code, id, message and timestamp keys.
Is this something that a regex can parse? Or this would need a parser with grammar?
Update:
This is not the same URI parsing problem. The message here is a body String thus may include '&' in the message part. Using the same split with '&' might cause a wrong split.
Also, the { }
are just the ideal function that needs to be replaced by the regex.