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