Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Regular expression search does not work with single quotes https://github.com/siyuan-note/siyuan/issues/14940

Daniel669b2884b10a
diff --git a/kernel/model/search.go b/kernel/model/search.go
index c676279b1c..fb0fa1f783 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 '")