Input var str='john,doe,"1,234.56",0.00,true'
I tried using following regex
var arr = str.match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);
but getting error of unterminated string .
A non-regex solution to achieve the following output
Desired output :
john,doe,1,234.56,0.00,true
var str='john,doe,"1,234.56",0.00,true'
var arr = str.match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g);
console.log(arr.join("."))