var text = "过滤敏感词及不文明用语"; var re = /敏感词|文明/gi; var output = text.replace(re, function(sMatch){ return sMatch.replace(/./g,"*"); });
var text = "过滤敏感词及不文明用语"; var re = /敏感词|文明/gi; var output = text.replace(re, function(sMatch){ return sMatch.replace(/./g,"*"); });