From cca253238eca14ed7373746c4cf79aae83f55b36 Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Tue, 17 Jan 2023 11:33:47 +0800 Subject: [PATCH] web flow filter regexp support case-insensitive --- web/client/src/lib/flow.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/client/src/lib/flow.ts b/web/client/src/lib/flow.ts index 7525bdf..f6ddfc4 100644 --- a/web/client/src/lib/flow.ts +++ b/web/client/src/lib/flow.ts @@ -270,10 +270,15 @@ class FlowFilter { if (!text) return // regexp - if (text.startsWith('/') && text.endsWith('/')) { - text = text.slice(1, text.length - 1).trim() + if (text.startsWith('/') && (text.endsWith('/') || text.endsWith('/i'))) { + let flags: string | undefined + if (text.endsWith('i')) { + flags = 'i' + text = text.slice(0, -1) + } + text = text.slice(1, -1).trim() if (!text) return - this.keyword = new RegExp(text) + this.keyword = new RegExp(text, flags) } // string else {