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

This commit is contained in:
Daniel 2025-05-31 17:44:22 +08:00
parent 572baa99bd
commit 669b2884b1
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1900,6 +1900,7 @@ func maxContent(content string, maxLen int) string {
} }
func fieldRegexp(regexp string) string { func fieldRegexp(regexp string) string {
regexp = strings.ReplaceAll(regexp, "'", "''") // 不需要转义双引号,因为条件都是通过单引号包裹的,只需要转义单引号即可
buf := bytes.Buffer{} buf := bytes.Buffer{}
buf.WriteString("(") buf.WriteString("(")
buf.WriteString("content REGEXP '") buf.WriteString("content REGEXP '")