mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix issue #448 - Issue with regex for whole word
This commit is contained in:
parent
6063246b96
commit
435c34604b
1 changed files with 4 additions and 4 deletions
|
@ -92,19 +92,19 @@ public class TimelineHelper {
|
|||
//If there are filters:
|
||||
if (BaseMainActivity.mainFilters != null && BaseMainActivity.mainFilters.size() > 0 && statuses != null && statuses.size() > 0) {
|
||||
for (Filter filter : BaseMainActivity.mainFilters) {
|
||||
if (filter.irreversible) { //Dealt by the server
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String filterContext : filter.context) {
|
||||
if (filterTimeLineType.getValue().equalsIgnoreCase(filterContext)) {
|
||||
if (filter.whole_word) {
|
||||
Pattern p = Pattern.compile("(^" + Pattern.quote(filter.phrase) + "\\b|\\b" + Pattern.quote(filter.phrase) + "$)", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
Pattern p = Pattern.compile("\\b(" + Pattern.quote(filter.phrase) + ")\\b", Pattern.CASE_INSENSITIVE);
|
||||
for (Status status : statuses) {
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.reblog != null ? status.reblog.content : status.content, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
else
|
||||
content = Html.fromHtml(status.reblog != null ? status.reblog.content : status.content).toString();
|
||||
|
||||
Matcher m = p.matcher(content);
|
||||
if (m.find()) {
|
||||
statusesToRemove.add(status);
|
||||
|
|
Loading…
Reference in a new issue