Yeah, I wasn't thinking and used the match variables as if there were only two sets of parens, rather than four. The updated version works for that simple case. However, I'd worry about unexpected data screwing it up potentially rather badly, and it only handles one type of quote mark; if you're
allowed to have both single and double quote marks and
nest them and escape quote marks within quotes with
backslashes, stuff gets messy fast.