需求正则过滤违规词, 根据违规词库中匹配到的词进行过滤掉:
1,每个违规词的每个字中间的特殊的字符也算,违规词长度2-n个不等.
var ma = "大傻逼".split('');
var regstr = ma.join('([^u4e00-u9fa5]*?)');
var str = "这是一篇文章,需要过滤掉大傻逼这三个词,大傻逼中间出汉字以外的字符 大_/_傻a1v逼和 大傻a1v逼";
var reg = new RegExp(regstr , 'g');
str.replace(reg,"<替换的词>");
如果有更加完美的正则,欢迎指点下!