Having 01:aa,bb,02:cc,03:dd,04:ee as input, I need to extract key-value pairs which are separated by comma. The problem that value can also contain comma. On the other hand, the limitation for indices is that they can only be two digit numerals, and the separator between key and value is always colon.
Hence, the result of the above input should be the following regex groups:
01:aa,bb
02:cc, (comma is optional, can be stripped if exists)
03:dd, (comma is optional, can be stripped if exists)
04:ee
I've tried using (\d{2}:.+?,)*(\d{2}:.+?)$, but this results in:
0: 01:aa,bb,02:cc,03:dd,04:ee
1: 03:dd,
2: 04:ee
Do you have any suggestions?