From 7446a20db8907acedbd14ddcc6a99de577268c1c Mon Sep 17 00:00:00 2001 From: Sascha Date: Wed, 5 May 2021 12:49:11 +0200 Subject: Do not greedy match quotes --- webui/src/pages/list/Filter.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'webui/src/pages') diff --git a/webui/src/pages/list/Filter.tsx b/webui/src/pages/list/Filter.tsx index 84b08029..496fb3ba 100644 --- a/webui/src/pages/list/Filter.tsx +++ b/webui/src/pages/list/Filter.tsx @@ -36,7 +36,7 @@ export type Query = { [key: string]: string[] }; function parse(query: string): Query { const params: Query = {}; - let re = new RegExp(/(\w+)(:('.*'|".*"|\S*))?/, 'g'); + let re = new RegExp(/([^:\s]+)(:('[^']*'\S*|"[^"]*"\S*|\S*))?/, 'g'); let matches; while ((matches = re.exec(query)) !== null) { if (!params[matches[1]]) { @@ -53,8 +53,8 @@ function parse(query: string): Query { function quote(value: string): string { const hasSpaces = value.includes(' '); - const isDoubleQuotedRegEx = RegExp(/^'.*'$/); - const isSingleQuotedRegEx = RegExp(/^".*"$/); + const isSingleQuotedRegEx = RegExp(/^'.*'$/); + const isDoubleQuotedRegEx = RegExp(/^".*"$/); const isQuoted = () => isDoubleQuotedRegEx.test(value) || isSingleQuotedRegEx.test(value); -- cgit