JSFiddle - React, Tailwind, and code Playground
JavaScript
var regex = /\bcommon\.js\b/g;
var str = 'For example, it should match "common.js" but not "common.min.js" For example, it should match "common.js" but not "common.min.js';
var result = str.replace(regex, "<SOME NAME>");
document.body.innerHTML = result;