From a0ac6e66f9ac8321af9c19bfffdc617365ddef30 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sun, 7 Jul 2024 10:55:31 +0200 Subject: [PATCH] Support regular expressions that are strings in the query language --- plug-api/lib/query_expression.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plug-api/lib/query_expression.ts b/plug-api/lib/query_expression.ts index 2fced298..c309bf04 100644 --- a/plug-api/lib/query_expression.ts +++ b/plug-api/lib/query_expression.ts @@ -249,6 +249,9 @@ function evalSimpleExpression(type: string, val1: any, val2: any, val3: any) { return val1 != val2; } case "=~": { + if (typeof val2 === "string") { + val2 = [val2, "i"]; + } if (!Array.isArray(val2)) { throw new Error(`Invalid regexp: ${val2}`); }