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:
Dave Hoover
2009-05-02 06:29:40 +00:00
parent 6eb8953c4b
commit f3e5b1a9c2
@@ -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("");