fix(katana): add [a-z0-9] to regex

Because we defined word boundary
This commit is contained in:
tretrauit 2024-01-13 02:52:10 +07:00
parent 0ab5c23a3b
commit 4f8a29230f

View File

@ -222,12 +222,12 @@ fn regexify_text(text: &String) -> String {
}
regex.push_str("(?=.*\\b");
let processed_word = word.to_lowercase();
if partial_match && processed_word.len() > 3 {
if partial_match && processed_word.len() > 4 {
if !processed_word[0..3].contains(|c: char| ['[', ']'].contains(&c))
&& !processed_word[word.len() - 2..word.len()]
.contains(|c: char| ['[', ']'].contains(&c))
{
regex.push_str(&processed_word[2..word.len() - 2]);
regex.push_str(format!("[a-z0-9][a-z0-9]{}[a-z0-9][a-z0-9]", &processed_word[2..word.len() - 2]).as_str());
} else {
regex.push_str(&processed_word.as_str());
}