From aa9e535fd1d8c785cf7d99add54f2e43ed312076 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Thu, 4 Apr 2024 09:10:41 +0800 Subject: [PATCH] :sparkles: Feature(custom): add u flag for gallery regexp match --- src/renderer/manage/utils/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/manage/utils/common.ts b/src/renderer/manage/utils/common.ts index e32120f..06c5543 100644 --- a/src/renderer/manage/utils/common.ts +++ b/src/renderer/manage/utils/common.ts @@ -182,7 +182,7 @@ export const svg = ` export function customStrMatch (str: string, pattern: string) : boolean { if (!str || !pattern) return false try { - const reg = new RegExp(pattern, 'g') + const reg = new RegExp(pattern, 'ug') return reg.test(str) } catch (e) { console.error(e) @@ -195,7 +195,7 @@ export function customStrReplace (str: string, pattern: string, replacement: str replacement = replacement || '' let result = str try { - const reg = new RegExp(pattern, 'g') + const reg = new RegExp(pattern, 'ug') result = str.replace(reg, replacement) result = renameFileNameWithCustomString(result, result, str) } catch (e) {