
这就是我要做的。
var str = 'a, b, c, "d, e, f", g, h';var arr = str.match(/(".*?"|[^",s]+)(?=s*,|s*$)/g);arr = arr || [];// this will prevent JS from throwing an error in// the below loop when there are no matchesfor (var i = 0; i < arr.length; i++) console.log('arr['+i+'] =',arr[i]);欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)