forked from upstream-mirrors/quik
Fix regex matching for message content filters
This commit is contained in:
@@ -62,10 +62,10 @@ class MessageContentFilterRepositoryImpl @Inject constructor() : MessageContentF
|
|||||||
} else if (filter.isRegex) {
|
} else if (filter.isRegex) {
|
||||||
Regex(filter.value).matches(messageBody)
|
Regex(filter.value).matches(messageBody)
|
||||||
} else if (filter.caseSensitive) {
|
} else if (filter.caseSensitive) {
|
||||||
val regexp = ".*\\b" + Regex.escape(filter.value) + "\\b.*"
|
val regexp = "[\\s\\S]*\\b" + Regex.escape(filter.value) + "\\b[\\s\\S]*"
|
||||||
Regex(regexp).matches(messageBody)
|
Regex(regexp).matches(messageBody)
|
||||||
} else {
|
} else {
|
||||||
val regexp = ".*\\b" + Regex.escape(filter.value.lowercase()) + "\\b.*"
|
val regexp = "[\\s\\S]*\\b" + Regex.escape(filter.value.lowercase()) + "\\b[\\s\\S]*"
|
||||||
Regex(regexp).matches(messageBody.lowercase())
|
Regex(regexp).matches(messageBody.lowercase())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user