real, надо найти в строке слово really и полностью его заменить. Эта реализация заменяет только часть совпадающую, т.е. корень realthis.api = this.api.replace(word, 'BOOM')
this.api = this.api.replace(word, 'BOOM')this.api = this.api.replace(RegExp(`\\b${word}[a-z]*\\b`, 'ig'), 'BOOM') const word = 'real';
const regexp = new RegExp(`${word}\\w*`, 'ig');
string = 'really, reality, super, universe';
console.log(string.replace(regexp, 'BOOM')); // BOOM, BOOM, super, universeconst words = ['real', 'super'];
const regexp = new RegExp(`(${words.join('|')})\\w*`, 'ig');
const string = 'really, reality, super, universe';
console.log(string.replace(regexp, 'BOOM')); // BOOM, BOOM, BOOM, universe