I am trying to create a Map from a multi-line String with various patterns. For example, considering the following String:
:20:94001142322029214336
1234
6789
:86F:/PG/1L123
:25|11298666
:28G::20/1345
xyz
My patterns are like:
starting : OR :: OR | OR || and ending with : OR :: OR | OR ||
I am trying to create a map as follows:
Key = 20
Value = 94001142322029214336
1234
6789
Key = 86F
Value = /PG/1L
Key = 25
Value = 11298666
Key = 28G
Value = 20/1 xyz
The value can be multi line so i need all the lines from value to be part of my map value for that key.
Could you please help me to create the Java regex or any other solution that can help me to create this map?
:and|and values may or may not be multiline text.