97
rated 0 times
[
103]
[
6]
/ answers: 1 / hits: 104674
/ 12 Years ago, thu, july 12, 2012, 12:00:00
I'm looking for [a, b, c, d, e, f, g, h]
to turn into an array of 6 elements: a, b, c, d,e,f, g, h. I'm trying to do this through Javascript. This is what I have so far:
str = str.split(/,+|[^]+/g);
But right now it's splitting out everything that's in the double-quotes, which is incorrect.
Edit: Okay sorry I worded this question really poorly. I'm being given a string not an array.
var str = 'a, b, c, d, e, f, g, h';
And I want to turn that into an array using something like the split function.
More From » regex