summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-05 07:59:43 +0200
committerThanos Apollo <[email protected]>2024-03-05 07:59:43 +0200
commit09ec1288d7b9446d47c8f55a758e0d142d4525d2 (patch)
tree1c57308fd4ab4ebca107ec60942de930d5dd4b99 /gnosis.el
parent755377b18edb13f48d967fb37fbe60222b7b70ad (diff)
gnosis-cloze-replace-words: Use regexp-quote
Having \\b would not work for words that have - or other nonregular symbols
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/gnosis.el b/gnosis.el
index 84e5ed8..574b34b 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -753,12 +753,12 @@ 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 (concat "\\b" 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.
- (error "`%s' is an invalid cloze for question: `%s'"
- word string )))
+ do (if (string-match (regexp-quote word) string)
+ (setq string (replace-match new t t string))
+ ;; This error will be produced when user has edited a
+ ;; note to an invalid cloze.
+ (error "`%s' is an invalid cloze for question: `%s'"
+ word string)))
string)
(defun gnosis-cloze-extract-answers (str)