[Solved] split double quoted string into array in javascript [closed]


Many ways to do it

Quick and dirty with split and filter out the empties

var string = '"abc""xyz""123"'
var result = string.split('"').filter(Boolean);
console.log(result);

Splitting with slice

var string = '"abc""xyz""123"'
var result = string.slice(1, string.length -1).split('""');
console.log(result);

A regular expression

var string = '"abc""xyz""123"'
var result = string.match(/[^"]+/g)
console.log(result);

solved split double quoted string into array in javascript [closed]