From 669b2884b10a0901767e840bd57c8ae445a9cd2b Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 31 May 2025 17:44:22 +0800 Subject: [PATCH] :bug: Regular expression search does not work with single quotes https://github.com/siyuan-note/siyuan/issues/14940 --- kernel/model/search.go | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/model/search.go b/kernel/model/search.go index c676279b1..fb0fa1f78 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -1900,6 +1900,7 @@ func maxContent(content string, maxLen int) string { } func fieldRegexp(regexp string) string { + regexp = strings.ReplaceAll(regexp, "'", "''") // 不需要转义双引号,因为条件都是通过单引号包裹的,只需要转义单引号即可 buf := bytes.Buffer{} buf.WriteString("(") buf.WriteString("content REGEXP '")