fix(katana): add [a-z0-9] to regex
Because we defined word boundary
This commit is contained in:
parent
0ab5c23a3b
commit
4f8a29230f
@ -222,12 +222,12 @@ fn regexify_text(text: &String) -> String {
|
|||||||
}
|
}
|
||||||
regex.push_str("(?=.*\\b");
|
regex.push_str("(?=.*\\b");
|
||||||
let processed_word = word.to_lowercase();
|
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))
|
if !processed_word[0..3].contains(|c: char| ['[', ']'].contains(&c))
|
||||||
&& !processed_word[word.len() - 2..word.len()]
|
&& !processed_word[word.len() - 2..word.len()]
|
||||||
.contains(|c: char| ['[', ']'].contains(&c))
|
.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 {
|
} else {
|
||||||
regex.push_str(&processed_word.as_str());
|
regex.push_str(&processed_word.as_str());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user