js remplacer le mot entier et non les mots dans les mots
const sampleString = "xsmall small medium";
console.log(sampleString.replace(/\bsmall\b/g, "test"));
Evil Emu
const sampleString = "xsmall small medium";
console.log(sampleString.replace(/\bsmall\b/g, "test"));