diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/chat/ChatFilter.java b/Client/src/main/java/de/com/baseband/client/feature/modules/chat/ChatFilter.java index 3d87b12..62782a9 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/modules/chat/ChatFilter.java +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/chat/ChatFilter.java @@ -125,11 +125,11 @@ public class ChatFilter extends Feature { } public boolean containsWord(String s, String word) { - return Pattern.compile("(?<=[  ](§.)?(§.)?(§.)?)" + word + "(?=\\W|$)", Pattern.CASE_INSENSITIVE).matcher(s).find(); + return Pattern.compile("(?<=[  ](§.)?(§.)?(§.)?)" + word + "(?=[^a-z]|$)", Pattern.CASE_INSENSITIVE).matcher(s).find(); } public String filter(String s, String word, String type) { - Pattern pat = Pattern.compile("(?<=[  ](§.)?(§.)?(§.)?)" + word + "(?=\\W|$)", Pattern.CASE_INSENSITIVE); + Pattern pat = Pattern.compile("(?<=[  ](§.)?(§.)?(§.)?)" + word + "(?=[^a-z]|$)", Pattern.CASE_INSENSITIVE); Matcher matcher = pat.matcher(s); StringBuilder result = new StringBuilder(s.length()); int last = 0; @@ -137,7 +137,7 @@ public class ChatFilter extends Feature { result.append(s, last, matcher.start()); switch (mode) { case Censor: - result.append(matcher.group().replaceFirst("[aeiou]", "*")); + result.append(matcher.group().replaceAll("[aeiou]", "*")); break; case Replace: result.append("[").append(type).append(" removed]"); @@ -155,14 +155,14 @@ public class ChatFilter extends Feature { // TODO expand public static final String[] ETHNIC_SLURS = new String[] { - "nig+a?e?h?r*", + "[a-z]*nig+a?e?h?r*[a-z]*", "negr+o(id)?", }; public static final String[] QUEERPHOBIC_SLURS = new String[] { - "trann\\w*", + "[a-z]*trann[a-z]*", "shemale", - "hon", + "hon[a-z]*", "subnormal", "troon", };