I am working on a file which has data in the following format in one of its column. I need to add double quotes to corresponding Key and values so that i can parse the string as a JSON
Input Data:
Street:StreetName,Address:ABC Road, CityName,PinCode:00000
I was trying with the below Regex and it somehow messes up the output as Address Key has , inside its value.
Regex i tried is ([a-zA-Z0-9-]+):([a-zA-Z0-9-,]+) with substitution as \"$1\":\"$2\"
Current Output (see the value of Key 'Address'): "Street":"StreetName","Address":"ABC" Road, CityName,"PinCode":"00000"
Expected Output: "Street":"StreetName","Address":"ABC Road, CityName","PinCode":"00000"
However, This works if there are no commas in the values
Input: Street:StreetName,Address:ABC Road CityName,PinCode:00000
Output: "Street":"StreetName","Address":"ABC Road CityName","PinCode":"00000"
I know something is missing in my regex. Any ideas on this please?
Thanks in Advance
;as delimiter between the first fields, and,between the last two - is that correct?,. Edited now.