From 26e69d50708f2c399b2159d6f8a739a415241cc2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 19 Aug 2020 15:35:20 +1000 Subject: [PATCH] ensure tag replacements fully match https://anki.tenderapp.com/discussions/private/5180-anki-desktop-bug-removing-a-tag-removes-all-substrings --- rslib/src/tags.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/tags.rs b/rslib/src/tags.rs index abf3de3f2..f1ef9e306 100644 --- a/rslib/src/tags.rs +++ b/rslib/src/tags.rs @@ -135,7 +135,7 @@ impl Collection { let tags = split_tags(tags) .map(|tag| { let tag = if regex { tag.into() } else { text_to_re(tag) }; - Regex::new(&format!("(?i){}", tag)) + Regex::new(&format!("(?i)^{}$", tag)) .map_err(|_| AnkiError::invalid_input("invalid regex")) }) .collect::>>()?;