From 2f29c48b9c90f10751bf24afdb5ab13f7fe4d3a8 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 10 Mar 2024 14:55:50 +0200 Subject: [fix] gnosis-cloze-replace-words: Fix string matching Fix string matching to only match whole words --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnosis.el b/gnosis.el index f9f855e..7f4f1de 100644 --- a/gnosis.el +++ b/gnosis.el @@ -799,7 +799,7 @@ Works both with {} and {{}} to make easier to import anki notes." "In STRING replace only the first occurrence of each word in WORDS with NEW." (cl-assert (listp words)) (cl-loop for word in words - do (if (string-match (regexp-quote word) string) + do (if (string-match (concat "\\b" (regexp-quote word) "\\b") string) (setq string (replace-match new t t string)) ;; This error will be produced when user has edited a ;; note to an invalid cloze. -- cgit v1.2.3