JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "I have a cat, a ducat, a locator, a catch, and a cathy.";
var mapObj = {
   cathy:"cat",
   cat:"ducat",
   ducat:"locator",
   locator:"catch",
   catch:"cathy"

};
str = str.replace(/(?<!\w)(cathy|cat|ducat|locator|catch)(?!\w)/gi, function(matched){
  return mapObj[matched];
});

alert(str);