I have a key-value string with the following pattern in my Java program:
[key1]value1[key2]value2[key3]value3
where key
s and value
s are Strings.
How can I parse this string and take key-value pairs in to a Map?
Firstly, by splitting the string with a regex, it should give the values and then parsing the string with the same regex could provide the keys. Coming up with this regex is the main issue of mine as I've hardly used regex.