var codigos = 'A121B12112C12212F12G01'; var exp = /[A-Za-z]\d+/g; var codigosExtraidos = codigos.match(exp); console.log(codigosExtraidos); let novoArray = [];
for (let i = 0; i < codigosExtraidos.length; i++){ let textoNoArray = codigosExtraidos[i]; let exp = /[A-Za-z]/g; let numeroNoArray = textoNoArray.replace(exp, ''); let number = parseInt(numeroNoArray); novoArray.push(number); } console.log(novoArray);