我用这个作为关键字s='young girl jumping'
function selfreplace(s) {
var words = ['man', 'jumping'];
var re = new RegExp('\\b(' + words.join('|') + ')\\b', 'g');
var specials = [];
var match;
var str = "";
while(match = re.exec(s)) {
str += match[0] + '(k)';
}
return str;
}
它正在返回jumping(k)
我希望结果是young(s) girl(s) jumping(k)