FIX: Censored word match fail if earlier partial match

This commit is contained in:
Dean Taylor 2014-10-17 02:43:28 +01:00
parent 01bb2d4c31
commit 0a5acba77e
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ Discourse.Dialect.addPreProcessor(function(text) {
if (!censorRegexp) { if (!censorRegexp) {
var split = censored.split("|"); var split = censored.split("|");
if (split && split.length) { if (split && split.length) {
censorRegexp = new RegExp("\\b" + split.map(function (t) { return "(" + t.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + ")"; }).join("|") + "\\b", "ig"); censorRegexp = new RegExp("\\b(?:" + split.map(function (t) { return "(" + t.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + ")"; }).join("|") + ")\\b", "ig");
} }
} }