I have a var that holds the following information [[code=666]],[[code=777]], I want to iterate trough those and save "666" and "777" in an array like {"666","777"}. I tried to the the following but it is saving it as {"6","6, "6", "7", "7", "7"}.
[code]
var t = this;
var regex = /\[\[code=.*?\]\]/gi;
var match = t;
match = t.data.u_pricing.match(regex);
var final_code = [];
if(match != null){
//itereate through the matches eg. [[code=666]] [[code=777]]
for( var i=0; i <match.length; i++){
var init_index = match[i].indexOf("=")+1;
var end_index = match[i].length-2;
for( init_index; init_index <end_index; init_index++){
final_code.push(match[i][init_index]);
}
console.log("FINAL CODE" + final_code);
}
}