javascript:csv-string-to-array
CSV String to Array
https://gist.github.com/Jezternz/c8e9fafc2c114e079829974e3764db75
const csvStringToArray = (data) => { const re = /(,|\r?\n|\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^,\r\n]*))/gi const result = [[]] let matches while ((matches = re.exec(data))) { if (matches[1].length && matches[1] !== ',') result.push([]) result[result.length - 1].push( matches[2] !== undefined ? matches[2].replace(/""/g, '"') : matches[3] ) } return result }
other versions
https://gist.github.com/plbowers/7560ae793613ee839151624182133159
javascript/csv-string-to-array.txt · Last modified: by Wulf Rajek