[REF] spreadsheet: use existing helper to escape regexp

closes odoo/odoo#109010

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
Lucas Lefèvre
2023-01-03 20:14:58 +01:00
parent 2270a046e9
commit d9b51737d3
@@ -27,6 +27,7 @@ import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import CommandResult from "@spreadsheet/o_spreadsheet/cancelled_reason";
import { checkFiltersTypeValueCombination } from "@spreadsheet/global_filters/helpers";
import { _t } from "@web/core/l10n/translation";
import { escapeRegExp } from "@web/core/utils/strings";
export class GlobalFiltersCorePlugin extends spreadsheet.CorePlugin {
constructor(config) {
@@ -207,7 +208,7 @@ export class GlobalFiltersCorePlugin extends spreadsheet.CorePlugin {
*/
_updateFilterLabelInFormulas(currentLabel, newLabel) {
const sheetIds = this.getters.getSheetIds();
currentLabel = currentLabel.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
currentLabel = escapeRegExp(currentLabel);
for (const sheetId of sheetIds) {
for (const cell of Object.values(this.getters.getCells(sheetId))) {
if (cell.isFormula) {