I want to split my string by (',') but ignore ',' if they are inside quotes. For example
" 2,2,4,'hello', 'world', 'hi, there' "
I want to split it so 'hi, there' will not be split into two different array elements in ruby. How can I do that? Probably use some regex?
EDIT: IF I use this, (from link to possible dublicate)
values = values.split(',(?=([^\"]*\"[^\"]*\")*[^\"]*$)', -1)
my string is split correctly, but now I can not use .delete_at() method on my array. Before I could do:
values.delete_at(20)