Can someone help check this snippet? I'm just looping on array but the last item return false or null even its matches the pattern.
let texts = ["Invoice_001_1", "Invoice_001_2"];
var regTest = /(([a-zA-Z 0-9]+)_([0-9]+)_([0-9]+)$|[a-zA-Z ]+_([0-9]+)$)/gi;
for(var x=0; x<texts.length; x++) {
console.log(texts[x]);
var matchReg = regTest.exec(texts[x]);
console.log(matchReg);
}