Parser: buscar primer valor numerico despues de letra

This commit is contained in:
2026-04-16 14:20:11 -03:00
parent bff306d91f
commit 6df8f96f9c
+2 -5
View File
@@ -727,11 +727,8 @@ for (const linea of lineas) {
for (const [clave, info] of Object.entries(mapeoParametros)) {
if (lineaLower.includes(clave)) {
let match = linea.match(/show_chart.*?(\d+\.?\d*)/);
if (!match) {
const claveEscaped = clave.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
match = linea.match(new RegExp(claveEscaped + '.*?(\\d+\\.?\\d*)'));
}
// buscar primer valor numérico después de cualquier texto (letra o palabra)
const match = linea.match(/[a-zA-ZáéíóúñÁÉÍÓÚÑ]+.*?(\d+\.?\d*)/);
if (match && match[1]) {
const valor = parseFloat(match[1].replace(',', '.'));
if (!isNaN(valor) && valor > 0 && valor < 1000) {