I would like to split a string deliminated by a character such as ‘&’, but in the case where some values contain the deliminator I would like to escape with double quotes. What is an elegant approach to splitting while ignoring the deliminating characters that have been escaped while also accounting for escape character escapes?
For example split this string properly
var1=asdfasdf&var2=contain””quote&var3=”contain&delim”&var4=”contain””both&”
Into:
var1=asdfasdf
var2=contain"quote
var3=contain&delim
var4=contain"both&
Incidentally, I am thinking Regex...