I want to extract some from a string that KEYs are separated from VALUEs by colon(:) and s separated by comma(,). The problem is that VALUEs can contain comma. As an example:
category:information technology, computer,publisher:Elsevier (EV),subject:Ecology, Evolution, Behavior and Systematics
In this example the KEYs that must extract are: category, publisher and subject. The final result must be as follow:
category = information technology, computer
publisher = Elsevier (EV)
subject = Ecology, Evolution, Behavior and Systematics
I tried to write a recursive regex but it doesn't work :
(category|publisher|subject):(.*?)(?:,(?R)|.?)
Can someone help to solve this problem. Thanks.