mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 08:56:36 +08:00
FIX: Censored word match fail if earlier partial match
This commit is contained in:
parent
01bb2d4c31
commit
0a5acba77e
|
@ -6,7 +6,7 @@ Discourse.Dialect.addPreProcessor(function(text) {
|
|||
if (!censorRegexp) {
|
||||
var split = censored.split("|");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user