Fix fallback: escape regex special chars
This commit is contained in:
@@ -729,7 +729,8 @@ for (const linea of lineas) {
|
||||
if (lineaLower.includes(clave)) {
|
||||
let match = linea.match(/show_chart.*?(\d+\.?\d*)/);
|
||||
if (!match) {
|
||||
match = linea.match(new RegExp(clave + '.*?(\\d+\\.?\\d*)'));
|
||||
const claveEscaped = clave.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
match = linea.match(new RegExp(claveEscaped + '.*?(\\d+\\.?\\d*)'));
|
||||
}
|
||||
if (match && match[1]) {
|
||||
const valor = parseFloat(match[1].replace(',', '.'));
|
||||
|
||||
Reference in New Issue
Block a user