Parser: buscar primer valor numerico despues de letra
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user