Suppose I have string variable:
var animals = "catdog caT dog cat";
I don't want cats, big caTs, and messy whitespaces. I've tried to use:
var rep = "cat"
var nocats = animals.replace(new RegExp(rep, 'g'), '');
and nocats is now "dog caT dog ", while I need "catdog dog"
What regexp should I use ?