I am trying to learn how to break up this string:
var str = 'red','blue','gree'
I have this working code:
var clean = str.replace(/\'/g, "");
var elements = clean.split(',');
which produces array ["red","blue","green"]
which is what i want however. id like to learn how to do this using regex.exec() method.
here is what i got:
var patt = /([^']+)/g;
var elem= patt.exec(str);
but this returns array ["red","red"]
any ideas?