I want to split a string by comma:
\"a,s\".split \',\' # => [\'a\', \'s\']
I don\'t want to split a sub-string if it is wrapped by par
Assuming that parentheses are not nested:
"a,s(d,f),g,h" .scan(/(?:\([^()]*\)|[^,])+/) # => ["a", "s(d,f)", "g", "h"]