fix unanchored regex in bulk tag add routine
Previously, it was not possible to add a substring of an existing tag. For example, with the tag "foobar", you could not add the tag "foo", "bar" or "oob". Because the match was unanchored, the regex checking whether the tag already existed determined that the tag was present when it was not.
This commit is contained in:
parent
4662a9fe1a
commit
a3a1f49be1
@ -152,7 +152,7 @@ impl Collection {
|
||||
let matcher = regex::RegexSet::new(
|
||||
tags.iter()
|
||||
.map(|s| regex::escape(s))
|
||||
.map(|s| format!("(?i){}", s)),
|
||||
.map(|s| format!("(?i)^{}$", s)),
|
||||
)
|
||||
.map_err(|_| AnkiError::invalid_input("invalid regex"))?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user