summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-10 14:55:50 +0200
committerThanos Apollo <[email protected]>2024-03-10 14:55:50 +0200
commit2f29c48b9c90f10751bf24afdb5ab13f7fe4d3a8 (patch)
tree0f84057603e8db8cfda764043637e05dc9c963d8
parentb95c25089f83cc42d3f7c76f02309603d9b4cd4b (diff)
[fix] gnosis-cloze-replace-words: Fix string matching
Fix string matching to only match whole words
-rw-r--r--gnosis.el2
1 files changed, 1 insertions, 1 deletions
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.