JSFiddle - React, Tailwind, and code Playground

by Anton Spirin

JavaScript

const words = ['real', 'super'];
const regexp = new RegExp(`(${words.join('|')})\\w*`, 'ig');
string = 'really, reality, super, universe';
alert(string.replace(regexp, 'BOOM'));