We don't need to make _stopMatcher match the entire content of the
text that contains the stop word since the filter only cares if it exists at all in the text. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5766 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -188,13 +188,13 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
String pattern = "";
|
String pattern = "";
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
if ("".equals(pattern)) {
|
if ("".equals(pattern)) {
|
||||||
pattern += ".*(";
|
pattern += "(";
|
||||||
} else {
|
} else {
|
||||||
pattern += "|";
|
pattern += "|";
|
||||||
}
|
}
|
||||||
pattern += "\\b" + StringUtil.replace(st.nextToken(), "*", "[A-Za-z]*") + "\\b";
|
pattern += "\\b" + StringUtil.replace(st.nextToken(), "*", "[A-Za-z]*") + "\\b";
|
||||||
}
|
}
|
||||||
pattern += ").*";
|
pattern += ")";
|
||||||
|
|
||||||
Pattern pat = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
|
Pattern pat = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
|
||||||
_stopMatcher = pat.matcher("");
|
_stopMatcher = pat.matcher("");
|
||||||
|
|||||||
Reference in New Issue
Block a user